# list all volume
docker volume ls
# check docker hub to get folder location
VOLUME [/var/lib/mysql]
# inspect and check 'Volumes' and 'Mounts' point
docker container inspect mysql
# source: real host path
# each container use different data folder, UNLESS we assign both to use 1 source
# this data live outside of containers, even if we remove containers (it's safe)
"Source": "var/lib/docker/volumes/xxxxxxxxxx/_data"
# destination: container path
VOLUME [/var/lib/mysql]
# set custom name for volume, instead of "xxxxxxxxxxx"
# assign both to use 1 source of named VOLUME
docker container run -d --name mysql1 -v mysql-data:/var/lib/mysql
docker container run -d --name mysql2 -v mysql-data:/var/lib/mysql
---
# create a new volume
docker volume create pspl
# check docker hub to get folder location
VOLUME [/var/lib/postgres/data]
# map old postgres version to pspl volume
docker container run -d --name pspl1 -v pspl:/var/lib/postgres/data postgres:9.1
# check log and stop old container
docker container stop pspl1
# map new container to pspl volume
docker container run -d --name pspl2 -v pspl:/var/lib/postgres/data postgres:9.2
SHOULD CREATE VOLUME IN DOCKERFILE