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?
;isn't being interpreted by your shell, but instead by the shell on the receiving end. You may need to quote the last argument. Consider:"cd /outputs && yarn ..."