I am using docker 1.9.1 and compose 1.6, I have am using the standard postgres container postgres:9.3.5
which has a data volume at /var/lib/postgresql/data
I want to externally mount that file into /data which is a different disk ( not the root partition). I added the following to my compose file.
volumes:
- /data/pg_data:/var/lib/postgresql/data
df -h
Filesystem Size Used Avail Use% Mounted on
/dev/xvda1 63G 5.9G 57G 10% /
devtmpfs 7.5G 120K 7.5G 1% /dev
tmpfs 7.5G 0 7.5G 0% /dev/shm
/dev/xvdb 985G 197M 934G 1% /data
starting the container results in my data volume not being present on /data. docker inspect reveals the following.
Mounts": [
{
"Source": "/data/pg_data",
"Destination": "/var/lib/postgresql/data",
"Mode": "rw",
"RW": true
}
]
if I use a symlink instead
/docker -> /data/pg_data
and update the docker-compose file accordingly, it all works. The data is in the right place on /data
Any ideas whats going on?