Home > database >  `$PATH: unknown` error when mounting the current directory in Docker
`$PATH: unknown` error when mounting the current directory in Docker

Time:12-15

I want to use Docker to manage multiple Python versions (I recently got a Mac with Apple Silicon and I use old Python environment).

Since I need to read Python scripts on Docker and save the output files (for later use outside the Docker environment), I tried to mount a folder (on my Mac) following this post.

However, it shows this error:

$ docker run --name dpython -it python-docker -v $(pwd):/tmp  /bin/bash

docker: Error response from daemon: OCI runtime create failed: container_linux.go:380: starting container process caused: exec: "-v": executable file not found in $PATH: unknown.
ERRO[0000] error waiting for container: context canceled

It works without -v $(pwd):/tmp. I tried to specify different folders such as ~/ and /Users/ but they didn't work.

CodePudding user response:

You must specify the volume before the image name:

$ docker run --name dpython -it -v $(pwd):/tmp python-docker /bin/bash
  • Related