Create a web directory
[root@docker ~]# mkdir /app/wwwroot -p
A bind operation, the source directory just created
[root@docker ~]# docker run -itd --name nginx-test --mount type=bind,src=/app/wwwroot,dst=/usr/share/nginx/html nginx
f1319854953c2133fa58c51805e2311ce730bd713d5d983bee85d58e0b91e7e8
Into the container
[root@docker ~]# docker exec -it nginx-test bash
Enter the directory where the file will be automatically hidden before
root@f1319854953c:/# ls /usr/share/nginx/html/
[root@docker ~]# cd /var/lib/docker/volume/nginx.volume/_date
Direct cd / app / wwwroot / under
[root@docker wwwroot]# touch index.html
[root@docker wwwroot]# vim index.html
<h1>xiaojghjkl</h1>
View the vessel had just the data
root@f1319854953c:/usr/share/nginx/html# cat index.html
<h1>xiaojghjkl</h1>