-
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 multiple dockerfiles which are interdependent #4489
Comments
Compose is straight up not designed to solve that problem. As you noted, your best bet right now is to run two commands. If you expect your configuration to grow more complex in the future, you might also want to take a look at dobi or similar tools. |
@shin ok thx. You can remove this issue. |
@immae1 You can add another abstraction layer and generate the Dockerfiles dynamically depending on what you need right now. A YAML and a short Python script can do the trick. Check, for example, my approach here https://github.com/larytet/dockerfile-generator |
I have the same use case. There's one service
As stated in the above issue comments, a run command needs to be specified. I chose |
I know this is an old issue, but just in case anyone else is getting here from Google etc.: Be aware that the previously described approach does not work with the current docker-compose v2. The deprecated v1 used to build images sequentially in the order as defined in the |
You can also force Compose to run the builds one at a time (non-concurrently) without disabling BuildKit by using |
|
hi there i have a question:
the resulted images must tagged as : web_base
My docker-compose_dev.yml:
if i run docker-compose -f docker-compose_dev.yml up --build
the first dockerfile is builded. The seccond dockerfile which depends on the first dockerfile is builded and the web container starts. but also from the first dockerfile a container named "web_base" is created which stops.
I want to build the 1. Dockerfile and then the 2. Dockerfile and create only 1 Container named web, how could this be reached?
I know that i could run docker build . -t web_base and then run docker-compose without the "web_base" service.But than i have to execute 2 commands...
thanks
The text was updated successfully, but these errors were encountered: