Julio Costa
Julio Costa

Reputation: 433

Store Docker image files on external drive in macOS

I'm using a Mac Book Pro with 128Gb disk. Is there any way to have the Docker images be stored on an external hard drive rather than on the Mac's main drive?

I don't have that much free space, and can't afford to remove any installed software. Ideally I'd like to have Docker fetch the images from an external drive. Can this be done using a symlink?

Upvotes: 23

Views: 16475

Answers (3)

wattry
wattry

Reputation: 994

I was able to get this working and documented it here:

This tutorial will explain how to setup an external disk to store docker images and containers.

https://github.com/09wattry/run-docker-external-storage

It is basically a symlink to the folders mentioned.

Upvotes: 4

Julio Costa
Julio Costa

Reputation: 433

Eventually figured out that docker can use a symlink. In a macOS setup the file that I want to place in an external drive is located at:

~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/

and is named

Docker.qcow2

Just move the file to an external disk drive (for instance) and create a symlink pointing to the new location.

Upvotes: 15

Exploring
Exploring

Reputation: 3379

Please create a symlink to your desired external drive location:

  • create a symlink from ~/Library/Containers/com.docker.docker to your external drive location
EHOME=/Volumes/<your-external-drive-name>
ln -s  $EHOME/Library/Containers/com.docker.docker ~/Library/Containers/com.docker.docker

Upvotes: 4

Related Questions