Storing local docker images on External HDD boot2docker

I’m using docker on my macbook air which unfortunately has quite limited hard drive space (120gb).

Was wondering how I could store containers on my external drive instead of the default (which I believe is /var/lib/docker/) ?

  • doing a docker build for the first time and ran into this massive error
  • What's benefit of docker's image layer?
  • Query docker embedded dns from host
  • How to run Linux libraries on Docker on Windows?
  • Docker: Use sockets for communication between 2 containers
  • Getting code inside the Docker container
  • EDIT: It is in fact not /var/lib/docker – when using boot2docker I believe the files are stored on the virtualbox instance.

  • Storring and pulling meta-information of a docker image
  • Curl in Docker entrypoint script
  • Gitlab CI: Persist MySQL data between stages
  • Docker: can't RUN psql commands from Dockerfile
  • Docker Container Failing To Start On Boot
  • Start a docker container based on condition
  • 2 Solutions collect form web for “Storing local docker images on External HDD boot2docker”

    After clearing your macbook folder, mount your external hard drive on that path:

    mount -t <fstype> -o defaults /dev/<your device> /var/lib/docker/

    For use with boot2docker, try with something like:

    mount -t vboxsf -o uid=1000,gid=50 /dev/<your device> /var/lib/docker/

    where <your device> could be for example sdb.

    You can do this by changing file location in docker.
    You can go to Preferences->Advanced, and under the storage path change the location to your external hard drive.

    View the screenshot for reference

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.