Eric Gagnon
Eric Gagnon

Reputation: 81

Docker Volumes - bind mount different filesystem to ../docker/volumes/

Running docker v1.10.1 on RHEL 7.1 using btrfs driver. I have a separate xfs partition where I'd like to mount data volumes. I'd prefer to let docker manage the volumes natively (ie using docker volume create). Does anyone know if mounting the xfs partition at ./docker/volumes will work? Or is there a way to configure docker to use a different mount point (on a different filesystem) for data volumes?

Setup:

Question:

Upvotes: 1

Views: 785

Answers (1)

Alejandro Galera
Alejandro Galera

Reputation: 3691

For docker version 17.09.0-ce, you can create a named volume and after that, mount your partition in volume folder:

docker volume create yourNamedVolume
mount -t xfs /dev/sdXX /var/lib/docker/volumes/yourNamedVolume/_data

After that, all docker containers that you start with --volume yourNamedVolume:/destination_folder will have your xfs data in specified destination_folder.

Upvotes: 1

Related Questions