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/) ?

  • docker-compose : Issue with .env path
  • Running Client program and API in same Docker Machine
  • Building software for/in Docker containers - how to manage?
  • Debate on using heavy duty java rest service on docker, should we switch?
  • When would a Docker image and its repository have different names?
  • pip cannot install websocket-server python packge
  • EDIT: It is in fact not /var/lib/docker – when using boot2docker I believe the files are stored on the virtualbox instance.

  • can not push files to remote host
  • sbt-docker invalid header field value "oci… runtime error: no such file error
  • what should I set in HTTP_HOST environment variable inside a docker for appengine task queue?
  • Is the 'local' vm required once the swarm cluster has been deployed?
  • Dockerfile automatically run passenger start with Rails
  • How can I restore my postgresql docker volume?
  • 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.