Docker Community Forums

Share and learn in the Docker community.

Unable to mount directory to container: mount destination not absolute

System: Ubuntu 20.04.2 LTS on WSL2
Docker: 20.10.7

I am Ubuntu on WSL2 and trying to run an image as a Docker container, which I downloaded from the developer’s repo.

The suggested command for mounting my pwd to the container’s /tmp folder was:

docker run --volume $PWD:/tmp -it container_name

However when I used the following commands:

docker run --volume /home/directory:/tmp -it container_name


docker run --mount type=bind,source=/home/directory,target=/tmp -it container_name

However, I am unable to mount the /tmp directory, and always get an error like this:

docker: Error response from daemon: OCI runtime create failed: invalid mount {Destination:[/tmp] Type:bind Source:/var/lib/docker/volumes/311a36642b066a8eaf23589bfc2af042c3b3f4651b25330b9000abdad9bb732b/_data Options:[rbind]}: mount destination [/tmp] not absolute: unknown.
ERRO[0000] error waiting for container: context canceled

I’m not sure if the above syntax is correct, and have tried different ways of using --mount or --volume to mount the /tmp directory.

If I am wrong, I would appreciate any advice you have on the exact correct syntax of the command. Thank you so much!

I had the same problem on Raspberry PI 4 with Ubuntu Server 20.04 in POD with Kubernetes.
to fix this error, I removed the VOLUME instruction in Dockerfile, i don’t know the reason… but now it works! :slight_smile: