I’m just started using Docker by installing Docker for Mac. There are no container or images.
How do I change images/container default storage directory to another location?
I’ve read How do I change the Docker image installation directory?
But I’m not sure if it’s applicable to OS X.
I’m also looking for the solution of this question.
When you have installed the docker via docker toolbox. The docker-machine VM is called “default” and it exists in /Users//.docker/machine/machines/default/ directory.
+1 bump. Did anyone figure this out?
That link talks about Docker Machine.
Docker for Mac takes care of this for you. This is stored inside the VM that we create, and currently there isn’t a way to change this.
May I know what use case this is for? I’d like to document this.
One reason I’d like to move them is just to stop my main drive filling with stuff. Being able to relocate the images, or the whole VM to another drive would be useful for those with small main drives and huge external drives.
+1, voting for this as well - I quickly run out of disk space on my MacBook Air when trying to bring up containers.
+1 what they said. I have been experimenting with Kitematic to achieve this but with minimal success thus far
What about simply moving
~/Library/Containers/com.docker.docker to another volume and symlinking it back to
Well what about adopting the ENV variables the same way docker toolbox would. ? I’m surprised that something like this is such a debate. Disk space is really an important factor and it think its obvious that one would want to be able to preserve their device as much as possible. I think being able to configure how a software uses up your disk space should be something taken into consideration when devising these tooling apparatuses.
Yes please, enable a way to changing this, it’s killing my main disk as well. What mbklein proposed is a nice workaround “patch” but not a real fix to a critical feature.
Like other my main disc on my mac is full I wish I could move the images on another disc.
Just to confirm, the proposed symlinking solution worked for me.
ProductName: Mac OS X
> docker --version
Docker version 1.12.3, build 6b644ec
> rsync --version
rsync version 3.1.2 protocol version 31
cp -R com.docker.docker /Volumes/..., I had to do
rsync -a com.docker.docker /Volumes/...
some files are “socket” files and they refused to be copied via cp.
Yep, just to confirm a second time - that’s a working solution…
Actually it’s fine to just move the Docker Image to the location of your choice and symlinking that. Then you don’t run into the socket errors mentioned by drwin:
mv /Users/<username>/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/Docker.qcow2 /<path-of-your-choice>/
ln -s /<path-of-your-choice>/Docker.qcow2 /Users/<username>/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/Docker.qcow2
When using Docker for Mac, there is a preference for the the storage location in the advanced tab. You change the location and confirm with
Apply & Restart. Docker for Mac will move the storage archive and take care of the rest. This can obviously take some time depending on storage size and disk speed… be patient.
this is working solution. thank you!
I used the move Disk image location option in Docker Preferences (Version 18.03.1-ce-mac65 (24312)) and after a restart Docker doesn’t find the images. Running docker images in Terminal doesn’t return anything other than the header fields. I moved the images to an external Transcend JetDrive to reduce the container build up on the Mac drive. Is there something else I need to do to point Docker to the images? I was thinking of uninstalling Docker then reinstalling and before creating anything change the image location but this is a bit more drastic than what I was hoping to do. Thanks!
Thanks, I was able to set this up using your suggestion. I took some time to document the process for anyone that comes in search of answers. How to store docker images and containers on an external drive.
For me works in macOS (Sierra and Catalina) with:
ln -s /Volumes/Transcend/com.docker.docker/data/Docker.qcow2 /Users/joseluisbz/Library/Containers/com.docker.docker/Data/vms/0/data/Docker.qcow2
Check the route is different.
I’m on desktop version 126.96.36.199. I changed the location in the preferences and clicked apply&restart. It successfully restarted. But when i check there is not file under the new folder i created as the new location. Also if i close the desktop interface and then opened it again, the path went back to the old one. I have tried multiple times but no luck. Is it a bug?
Thanks for your post, this helped me too.