Docker volume on external hard drive

I’m using a postgres image to run a container locally.
I need to process a significant amount of data and I want to use an external hard drive for this. Is it possible to mount a volume on an external hard drive? Can I accomplish what I want with Flocker?

I’m using native docker for mac.

  • Sharing installed tools from one container to all containers with docker compose
  • Docker engine startup with parameters on OS X Sierra
  • MongoDB “Unable to establish lock” error on mounted drive using Docker and Lustre
  • Trying to connect to Ammonite sshd when app is running in docker container
  • ERR_EMPTY_RESPONSE for localhost when running Docker
  • Using zookeeper for service discovery of mesos slaves running docker
  • Running docker on Ubuntu: mounted host volume is not writable from container
  • how to use --since option with docker logs command
  • traefik hostname works for web apps but not for mongodb
  • docker error: /var/run/docker.sock: no such file or directory
  • docker for windows equivalent for “-v /var/run/docker.sock:/var/run/docker.sock”
  • Docker mysql image: periodic access denied for root
  • 2 Solutions collect form web for “Docker volume on external hard drive”

    Mount the external drive on your mac, and then go to the Docker icon -> preferences -> file sharing. Add your drive path to that list. Then when you do a docker run -v /path/to/drive:/target myimage it will mount your drive into your container (at /target in that example).

    In Docker-for-mac, open up the preferences pane. Click on “File Sharing”.

    You can add the path to your external hard drive there, probably something like /Volumes/Drive.

    You’ll then be able to use that location as a host volume.

    docker run -v /Volumes/Drive/mypostgresdata:/var/lib/postgresql/data --name some-postgres -e POSTGRES_PASSWORD=mysecretpassword -d postgres
    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.