title: Copy or scp files to /var/lib/boot2docker for boot2docker VM managed by docker-machine
body: <p>To use Docker on OS X, I'm using a boot2docker VM running in VirtualBox, managed by docker-machine. The <a href="https://github.com/boot2docker/boot2docker/blob/master/doc/FAQ.md#local-customisation-with-persistent-partition" rel="nofollow">boot2docker documents mention a persistence volume <code>/var/lib/boot2docker</code></a>. I would like to copy a file <code>bootlocal.sh</code> on the host filesystem over to the boot2docker VM.</p>
  
  <p>I thought that <a href="https://docs.docker.com/machine/reference/scp/" rel="nofollow">docker-machine's <code>scp</code> command</a> would work for this,</p>
  
  <pre><code>docker-machine scp bootlocal.sh dockerhost:/var/lib/boot2docker/
  </code></pre>
  
  <p>Unfortunately, this gives</p>
  
  <pre><code>scp: /var/lib/boot2docker/bootlocal.sh: Permission denied
  exit status 1
  </code></pre>
  
  <p>Checking the file permissions, we can see that <code>root</code> is the only one with write permissions to this directory, by default:</p>
  
  <pre><code>docker@dockerhost:~$ ll -d /var/lib/boot2docker
  lrwxrwxrwx    1 root     root            29 May 31 17:40 /var/lib/boot2docker -&gt; /mnt/sda1/var/lib/boot2docker/
  docker@dockerhost:~$ ll -d /mnt/sda1/var/lib/boot2docker
  drwxr-xr-x    6 root     root          4096 May 31 17:40 /mnt/sda1/var/lib/boot2docker/
  </code></pre>
  
  <p>It is not possible to specify the user <code>root</code> as the one to use with <code>docker-machine scp</code>.</p>
  
  <p>How does one copy files to <code>/var/lib/boot2docker</code>, preferably from the host machine? </p>