-1

I am running a docker container with Ubuntu Xenial image on my macOS Big Sur using the command sudo docker run -it ubuntu:xenial and it works fine, giving me a Linux terminal.

However, I want to attach a volume to my container so that I can save the work that I do within the ubuntu terminal that I get from within the container on my Mac's filesystem. For that, I tried to run the following command:

sudo docker run -it ubuntu:xenial -v /Users/myname/Documents/UbuntuWorkspace

(I had previously created the directory named UbuntuWorkspace)

But I encountered the following error when I tried to run the above command:

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 

So, what is the right way to attach a directory on my Mac's filesystem to the Ubuntu docker container that I run, so that I can save my work and also view it on the finder app?

Suraj S Jain
  • 515
  • 3
  • 10
  • 24

1 Answers1

1

You also need to add the path to the dir in container and maybe you should use image name after all arguments

sudo docker run -it -v /Users/myname/Documents/UbuntuWorkspace:/some/path ubuntu:xenial

Docs

Makariy
  • 725
  • 7
  • 16