Here in the docs, it seems to say you CAN use image with build, but it’s about creating an image not using one.
Can I somehow use ARGS along with an image in the compose file? The usecase for this is, that the postgres image uses onbuild or something, and requires build time variables to be entered in. So I can’t get the user to be created when I do docker-compose build db
You can use image and build side by side, but not one nested inside of the other like you have above. Note that image is a key of build in your example.
Our docker hub hosted image is expecting a build argument to set the domain in apache for a dev environment. I have tried using the context flag under build but then it looks for a local dockerFile. I need to pass the build args to the remote image that gets pulled down.
Receiving this error:
ERROR: The Compose file is invalid because:
Service myApp has neither an image nor a build context specified. At least one must be provided.
Got:
# docker-compose up -d
ERROR: The Compose file is invalid because:
Service firefox has neither an image nor a build context specified. At least one must be provided.
I found out why it doesn’t work. The context is the entire repository so all the paths are resolved from the root path of the repo. The solution would be to have the directory NodeFirefox in its own repository