docker compose already allows for overriding Dockerfile CMD. It would also be nice if there was the ability to override the Dockerfile WORKDIR as well.
For example:
version: '3'
services:
test:
build: .
workdir: /newworkdir
command: echo "hello"
I believe this is possible because docker run
takes --workdir
as an option. I didn't see this as an option in the current version of the docker compose documentation.
We do, the option's called working_dir
!
I didn't see that in the docs, thanks!
Most helpful comment
We do, the option's called
working_dir
!