Reputation: 42500
I am running a yarn
command inside node docker container and I'd like to change the working directory on docker run
command. The current command I am using is:
docker run -v $(pwd)/$BUILDDIR:/outputs -it --rm node:12.16.2-alpine3.11 cd /outputs;yarn install --only=production --pure-lockfile
I got this output:
sh: can't open 'cd': No such file or directory
yarn install v1.22.4
[1/4] đ Resolving packages...
success Already up-to-date.
⨠Done in 0.13s.
It seems that it tries to run cd
as a script file. How can I change working directory without updating docker image?
Upvotes: 1
Views: 2232
Reputation: 48572
Use --workdir
or -w
instead of trying to cd
:
docker run -v $(pwd)/$BUILDDIR:/outputs -it --rm -w /outputs node:12.16.2-alpine3.11 yarn install --only=production --pure-lockfile
Upvotes: 2