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
or
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!