title: mounting a docker volume to a docker container
body: <p><strong>This Works</strong></p>
  
  <p>To create the docker volume without specifying the disk size:</p>
  
  <pre><code>  docker volume create disk1
  </code></pre>
  
  <p>To  mount the volume(disk1) to a container </p>
  
  <pre><code>  docker run -itd -v disk1:/data ubuntu
  </code></pre>
  
  <p><strong>This is Not Working</strong></p>
  
  <p>Now creating the docker volume by specifying a size of 100mb</p>
  
  <pre><code>  docker volume create --name disk2 --opt o=size=100m
  </code></pre>
  
  <p>To  mount the volume(disk2 which is of size 100 MB) to a container </p>
  
  <pre><code>  docker run -itd -v disk2:/data ubuntu
  </code></pre>
  
  <p>when I run these commands I was getting the following error </p>
  
  <blockquote>
    <p>docker: Error response from daemon: error while mounting volume '/var/lib/docker/volumes/disk2/_data': missing device in volume options.</p>
  </blockquote>