Specify location of volumes in docker

I need to create a container specifying the location of volumes (not a bind mount).

The container has a volume /var/www, is possible to choose the location on the host machine? (i want to save in /data/www not in /var/lib/docker….). I can’t do with -v (bind mount) the /var/www folder has data.

  • How can I attach volumes with docker-compose only when in the development environment?
  • Docker container can not be found using curl
  • Change Default Docker Image Download Location in Fedora 23
  • Ansible docker_container 'no Host in request URL', docker pull works correctly
  • error with docker-compose and django
  • PostgreSQL PGDATA from host in Docker-System
  • Cannot make/remove an entry for the specified session - cron
  • How to create Dockerfile which installs Python 3 and nltk in a Ubuntu container?
  • How to launch AVD while keep running docker
  • Is there any way to disable a service in docker-compose.yml
  • Mount point not found
  • Among Kubernetes, OpenShift, Docker Swarm and Docker DataCenter deployment tools which all are having automatic rollback?
  • One Solution collect form web for “Specify location of volumes in docker”

    I can’t do with -v (bind mount) the /var/www folder has data.

    The first order of business would be to get those data on your host (in your host /data/www): run your container, and docker inspect it in order to get the path of the volume it uses (the one in /var/lib/docker/volumes/...): you can copy those files onto your host.

    Then you can bind mount that host /var/www folder to your container.

    But the better practice remains to use volumes (with the new 1.9+ docker volumes API), and mount it with --volumes-from.

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