title: How to attach a volume to a Docker container running Ubuntu on Mac?
body: <p>I am running a docker container with Ubuntu Xenial image on my macOS Big Sur using the command <code>sudo docker run -it ubuntu:xenial</code> and it works fine, giving me a Linux terminal.</p>
  <p>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:</p>
  <p><code>sudo docker run -it ubuntu:xenial -v /Users/myname/Documents/UbuntuWorkspace</code></p>
  <p>(I had previously created the directory named <code>UbuntuWorkspace</code>)</p>
  <p>But I encountered the following error when I tried to run the above command:</p>
  <pre><code>docker: Error response from daemon: OCI runtime create failed: container_linux.go:380: starting container process caused: exec: &quot;-v&quot;: executable file not found in $PATH: unknown.
  ERRO[0000] error waiting for container: context canceled 
  </code></pre>
  <p>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?</p>