I’m trying to learn from scratch so I’m building my own images to gain some experience but i am confused about how to declare volumes.
I create volumes for “data containers” so that I can share the volume with another container who will use the share to add persistent data (/var/www, /var/lib/mysql, …)
docker create -it --name=db-data --volume=/var/lib/mysql test/centos7:7.1.1503 bash docker run -d --name=db -p 3306:3306 --volumes-from=db-data -e MYSQL_ROOT_PASSWORD="test" test/mariadb55:5.5.41 mysqld_safe
But now that I am playing with Dockerfiles, I see there is also mention of volumes
I do not understand the difference between a volume specified in a Dockerfile and one specified on the CLI.
Can you help?