Reputation: 41
Suppose I have the following dockerfile:
FROM node:alpine
WORKDIR /src/mydir
Now, suppose I want to run docker-compose from the src/
folder as opposed to src/mydir
as happens by default.
I tried the following:
docker-compose run my_container ../ my-task
However the above failed.
Any guidance is much appreciated!
Upvotes: 2
Views: 3396
Reputation: 374
You want to use the --workdir
(or -w
) option of the docker-compose run
command.
See the official documentation of the command here: https://docs.docker.com/compose/reference/run/
For instance, given your above example:
docker-compose run my_container -w /src my-task
Upvotes: 2