May 2018
Intermediate to advanced
492 pages
12h 3m
English
The db-userauth and db-notes Dockerfiles contain VOLUME /var/lib/mysql, and when we started the containers, we gave --volume options, assigning a host directory for that container directory:
docker run --name db-notes \ ... --volume `pwd`/../notes-data:/var/lib/mysql \ ...
We can easily see this connects a host directory, so it appears within the container at that location. Simply inspecting the host directory with tools such as ls shows that files are created in that directory corresponding to a MySQL database.
The VOLUME instruction instructs Docker to create a directory outside the container and to map that directory so that it's mounted inside the container on the named path. The VOLUME ...
Read now
Unlock full access