-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
docker-compose build <service-name> not following depends_on order #6332
Comments
Hi @ArtyMcFlyHA The effects of the |
Hi @shin- Thanks for the quick response as well as the clarity you've provided! I will definitely look into dobi, thank you for the recommendation! :) I will say though, I believe as written at the time of this issue creation, we see the documentation painting different pictures. IMHO, it does not clearly outline that build ordering is not an intended usage. https://docs.docker.com/compose/compose-file/#depends_on the "simple example" even includes a service that has a build context. I realize documentation is a separate issue, but I'd advise that "simple example" have it's build context removed and I'm not alone in thinking this should've worked, I tracked down a couple posts on other internet forums on the topic where other devs also believe that |
This solution can help |
There is nothing in the docs about what the effects of Further, |
@shin- Is dobi still recommended? I see that dobi has not received commits since July. I am trying to evaluate what tool to use because we have outgrown docker-compose build. |
I am here because like others I feel the documentation is lacking. I spent a couple hours because of this simple example on https://docs.docker.com/compose/compose-file/
There are no comments that lead me to believe that the behavior is anything but
|
Wow! So |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue has been automatically closed because it had not recent activity during the stale period. |
Hi, I'd like to re-open this issue as I think having a way to prioritize docker builds would be very helpful. Thanks. |
I think it is now possible to prioritize builds correctly using the This does not seem to be supported in compose syntax, it is necessary to use the json/hcl bake syntax instead. |
Description of the issue
docker-compose build <service-name>
does not appear to followdepends_on
likedocker-compose up -d <service-name>
. Note, this is different than #5228 which has a similar wording, but the linked issue does not usedepends_on
in the docker-compose.yml file.Context information (for bug reports)
The Dockerfiles in question:
Output of
docker-compose version
Output of
docker version
Output of
docker-compose config
(Make sure to add the relevant
-f
and other flags)Steps to reproduce the issue
docker system prune -a
(to ensure no local images cached)docker-compose build nodejs
Observed result
nodejs
is attempted to be built without attempting to buildalpine
first and an error occurs as a result. (stacktrace below)Expected result
I expected
alpine
to build first,nodejs
to build second. Ifdocker-compose up -d nodejs
is run instead ofdocker-compose build nodejs
than alpine is built first as expected. I am expecting the following output:Stacktrace / full error message
Additional information
macOS High Sierra version 10.13.6
Note,
docker-compose build
appears to work as expected (though that may be due to alphabetical ordering of service names?). However, the above is a boiled down least code replication of the issue. A more practical example of where this issue becomes a problem is when there are several dozen services and only 1 or 2 need to explicitly have their images/dependencies built.Also note, I replaced the private registry domain I'm using with
my-private-registry
. If you use a made up repository, the error will readService 'nodejs' failed to build: pull access denied for my-private-registry/alpine, repository does not exist or may require 'docker login'
instead of... failed to build: ... not found
. That said, expected output should be the same as above.The text was updated successfully, but these errors were encountered: