Data volume

It is used to map data in containers to Linux systems so that the data remains even after the container is deleted, data persistence

mount

-v External path: indicates the internal path of a container

A named mount

docker run -d -p --name nginx01 -v /home:/etc/nginx nginx
Copy the code

Anonymous mount

docker run -d -p --name nginx02 -v /etc/nginx nginx
Copy the code

Unspecified path are mounted in/var/lib/docker/volumes/XXXX / _data while forming

Data synchronization

Volumes from a two-way copy technology

Docker run -d -p --name nginx02 --volumes from nginx01 Docker run -d -p --name nginx02 --volumes from nginx01 If you create a test. Java file in Nginx01, you will also have this file in Nginx02. Even if you delete nginx01, the data in Nginx02 will still exist.Copy the code