question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Local Changes Requires Docker Hub Auth

See original GitHub issue

I just want to make faster local development. At our company we have different cicd pipeline so I shouldn’t send new images a hub. If there is a small change I am following next commands to achieve changes. It takes time.

cd Mgnfcnt-Project;
rm -rf ./target;
mvn clean install -DskipTests;
docker stop Mgnfcnt-Project && docker rm Mgnfcnt-Project && docker rmi mgnfcnt_Mgnfcnt-Project;
docker-compose up -d Mgnfcnt-Project;

I dont know whether JIB is right solution or not for my problem but using as following:

      <plugin>
        <groupId>com.google.cloud.tools</groupId>
        <artifactId>jib-maven-plugin</artifactId>
        <version>2.1.0</version>
        <configuration>
          <from>
            <image>mgnfcnt_Mgnfcnt-Project:latest</image>
          </from>
          <to>
            <image>mgnfcnt_Mgnfcnt-Project</image>
          </to>
        </configuration>
      </plugin>

But still wants to reach docker hub as gives following error:

Failed to execute goal com.google.cloud.tools:jib-maven-plugin:2.1.0:build (default-cli) on project Mgnfcnt-Project: Build image failed, perhaps you should make sure your credentials for ‘registry-1.docker.io/library/mgnfcnt_Mgnfcnt-Project’ are set up correctly. See https://github.com/GoogleContainerTools/jib/blob/master/docs/faq.md#what-should-i-do-when-the-registry-responds-with-unauthorized for help

Thanks in advance

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:35 (19 by maintainers)

github_iconTop GitHub Comments

1reaction
chanseokohcommented, Apr 4, 2020

On a fast network, ideally consecutive jib:build (i.e., remote registry push) runs without any changes should take a few seconds. If you make a change only to your application, normally it should still take a few or several seconds (excluding the time to rebuild your classes with mvn compile).

jib:dockerBuild should usually be comparably fast. It can be faster than jib:build if your image is reasonably small and your machine is good enough; it can be slower if your image is huge.

I will update here about “RUN” later.

0reactions
chanseokohcommented, Jun 4, 2021

Sorry for the late update. Re: putting arbitrary files into to the image, please see this doc.

If you need, you can leverage other plugins to dynamically download files online and put them into one of the <extraDirectories> at compile-time. Here’a an example to download a Cloud Java Debugger agent.

Regarding why you can’t do Dockerfile’s RUN-like things in Jib, I’ll quote the following comments (from https://github.com/GoogleContainerTools/jib/issues/1806#issuecomment-505526975 and https://github.com/GoogleContainerTools/jib/issues/2249#issuecomment-578937936).

the way Jib builds an image is fundamentally different from how the Docker CLI builds an image using Dockerfile (reproducible vs. non-reproducible, declarative vs. imperative, Docker and Dockerfile-less build vs. requiring Docker daemon and client, requiring root-privilege vs. not). Jib is in a very different realm, so unfortunately, it is very difficult to support ONBUILD unless we radically change our opinionated philosophy in how an image should be built. Basically, we don’t “run” Dockerfile directives, particularly the ones like RUN that executes something. Jib doesn’t provide/include a Docker runtime (that is one of the points of Jib).

And as for running arbitrary commands, unfortunately this is largely incompatible with the mode Jib operates in, because the way Jib builds an image is fundamentally different from how Docker does: https://github.com/GoogleContainerTools/jib/issues/1806#issuecomment-505526975 We build images in a declarative and reproducible way without actually requiring to have a runtime component to be able to run an image at image build-time; running an image basically destroys reproducibility. So unfortunately it is very difficult for Jib to support “running” arbitrary commands at image building-time.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Manage access tokens - Docker Documentation
Docker Hub lets you create personal access tokens as alternatives to your password. You can use tokens to access Hub images from the...
Read more >
docker unauthorized: authentication required - upon push with ...
Step 1: log in to docker hub. Based on @KaraPirinc's comment, in Docker version 17 in order to log in: docker login -u...
Read more >
Docker Hub and Docker Registries Beginner's Guide - JFrog
A practical step-by-step guide to set up and use Docker Hub, Docker's official and default container registry.
Read more >
Troubleshooting errors with Docker commands when using ...
Check that your local disk has enough remaining free space to store the Docker image you are pulling. You can also delete old...
Read more >
Support for Docker and OCI — Singularity container 3.0 ...
Because this image from Docker Hub is cached locally in the ... Authentication is required to access private images that reside in Docker...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found