-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Local Changes Requires Docker Hub Auth #2383
Comments
Hi @mgnfcnt, For the base image, you are using a tag Moreover, do note that, even if Consider using a digest (e.g., |
Oh, I just noticed your target repository is also |
@chanseokoh Thanks for your answers, because of these are local images, I am producing them via docker-compose up --build command. Because of this when I run |
And one tip using
This will be far faster:
And I don't really get why you do
|
Why I need to make clean install is creating jar file under target, This is my Dockerfile.local used by docker-compose.yml
|
Oh, you are not using Jib yet. If you use Jib, it would just be
and this will be super fast. Try yourself. And if your base image is very large, Lastly, it's probably not right to use same repository |
@chanseokoh The problem is I dont have sha codes for local images so it is trying to retrieve from docker hub but my images not located any hub server. |
@mgnfcnt I am not sure if you are following all of these. Or maybe we are not on the same page. In this case, I think
I thought your main goal is to achieve fast local development? For that matter, you can just apply the Jib plugin and do what I said in #2383 (comment) Sorry, I have to go offline for some time for now. However, I am not sure what exactly the issue you are facing is or what the ultimate goal you are trying to achieve is. |
@chanseokoh Let me start from initial step: I have several spring boot projects and they all run on docker. I have a docker-compose.yml file as:
And this is my Dockerfile.local
While development if I make any code change, I am doing following ones in order to reflect the changes:
It takes for a while and making this each code change is waste of time. So I thought jib can be better solution in order to achive, reflecting each change to docker container faster. In order to achive this, I just added following to pom.xml
Also tried to add sha key.but because this image doesn't exists at docker hub and won't pushed to there it doesn't have any sha code. When I use Only docker inspect mgnfcnt_mgnfcnt-project gives sha codes also tried it. But all gives following error:
and
|
Thanks for the update. Here is basically what you need to do
|
@chanseokoh Thanks for your patience and kindly answers. Now I am trying to do above steps you mention. But it took 20 mins to 55% for
And it gave timeout several times:
I hope this is related with my poor network connectivity but I don't know what is trying to be downloaded because I already have adoptopenjdk/openjdk8 image. And I veried it with docker images command.
My next question is, as I already mention before, there are several other services and I run their container simple If I remove following and add
There wont be image at initial run, and I need to run all these service one by one, right? Is there any better way to achieve this? |
@chanseokoh And also I couldn't find RUN command's equivalence in container section: https://github.com/GoogleContainerTools/jib/tree/master/jib-maven-plugin#container-object I need to run these kind of commands for some services also
|
Note that Jib doesn't require Docker and doesn't make use of it. Therefore, Jib needs to download and cache the base image for the first time. If your network is slow, I recommend you run Jib in a separate terminal, leave it open, and forget it. Once Jib cached the base image, the next build will be super fast. Another workaround is to instruct Jib to get the base image stored in your Docker daemon with
Sorry, it was a long time ago that I used
Let's assume that your mgnfcnt-project:
container_name: mgnfcnt-project
build:
context: Mgnfcnt-Project
dockerfile: ./Dockerfile.local
some-service:
container_name: some-service
build:
context: some-service-project-root
dockerfile: ./Dockerfile.local
another-service:
container_name: another-service
build:
context: another-service-project-root
dockerfile: ./Dockerfile.local You don't have to convert every service to use Jib right now. So, I would go first with mgnfcnt-project:
container_name: mgnfcnt-project
image: mgnfcnt_mgnfcnt-project # should match <image><to>
some-service:
container_name: some-service
build:
context: some-service-project-root
dockerfile: ./Dockerfile.local
another-service:
container_name: another-service
build:
context: another-service-project-root
dockerfile: ./Dockerfile.local Then, when doing Does this make sense? |
You may try increasing timeouts with Regarding |
@chanseokoh it seems building but changes are not reflecting in image. It prints older value always. when I chack |
There must be something you are mssing. Did you do |
@chanseokoh Environment variables aren't being reflected:
Because of these environment variables not being setted, it gives null pointer exception:
|
It is not a null pointer exception but an index out of bounds. It means the value doesn't contain the colon ( |
@chanseokoh I have removed environment variables from plugin because they already exist at docker-compose.yml file:
Container running but I have auth issues:
|
@chanseokoh What is port mapping equivalence at jib? this is from docker-compose.yml
|
And also, somehow spring boot starting from 8080 port, normally it should be 8090
|
@chanseokoh I made a temporary solution and added server.port to application.properties of the spring boot project, Changes are being reflected. I just have one concern; it takes 44 seconds for Is it normal? |
The default port of a Spring Boot app is 8080. You can change it in many different ways. One option is to pass <container>
...
<args>
<arg>--server.port=8090</arg>
<args>
</container>
This is the
I'm sorry, but I just cannot resolve all of your application and proxy issues. What is certain is that, if there's something not working around some environment variables, then it must be some misconfiguration on your side. At least I can say Jib will inherit all the environment variables from the base image and add environment variables configured in <container>
...
<environment>
<PATH>/usr/bin</PATH>
<JAVA_HOME>/usr/lib/jvm/openjdk-11</JAVA_HOME>
</environment>
</container> |
No, it is not normal. |
What's the result of the following? I mean the time for running each command.
|
And are you still using |
First of all, thank you very much for all your efforts. I feel I am misunderstood about something. I have no intention of configuring you my entire system. Here I read all the documentation before asking you, I am looking at all previously opened issues related to specific problems. The main problem here is that jib does not have good documentation. Here I write all the configurations so that others with the same error can solve their problems in a short time. |
No worries. Thanks for the feedback. If you had any trouble getting information from the Maven plugin doc (or any other docs), please do point out and we will improve it. |
|
Using following one, also tried docker one with/out sha, and also tried to add sha for following
|
All of your commands are taking ~29 seconds, which seems very unusual. Note that |
@chanseokoh I will investigate the issue apart from this. I just wanted to know what is the ideal execution time of jib command. I am glad jib is working on my machine finally. I think we can close the issue. Also I am looking forward to hear how to add "RUN" command to maven jib plugin. It is not urgent but I will need it at future. Thank you very much |
On a fast network, ideally consecutive
I will update here about "RUN" later. |
Updates after chatting privately with @mgnfcnt: One reason Jib was slow was due to the slow network. It was taking >14 seconds to download an image manifest (which is a small JSON).
Using a SHA as explained in #2383 (comment), is one way to avoid checking the manifest online. Another option is force offline by
And loading an image to Docker was taking 10 seconds, which may not be so bad depending on the size of the image. I think the machine is not so powerful. Note that, as explained before, pushing directly to a registry with It's a shame that Docker Engine API is limited and |
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 Regarding why you can't do
|
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.
I dont know whether JIB is right solution or not for my problem but using as following:
But still wants to reach docker hub as gives following error:
Thanks in advance
The text was updated successfully, but these errors were encountered: