docker utilizing data volume volumes-from mount directory

Here's to mysql and nginx for example, reference data volume during the presentation start nginx mysql container and container mount directory

 

first step:

Create data volumes, enter the command:

docker run -d --name data-volume -v / mnt / mysql / conf: / etc / mysql -v / mnt / mysql / data: / var / lib / mysql -v / mnt / nginx / config: / etc / nginx / conf.d centos
container to create:

But the container is always in a state of non-operation, but it does not matter, as long as it can be a reference to

See if successful mount directory, enter the following command:

docker inspect data-volume

Figure:

Step two:

Create mysql container, enter the command:

docker run -d --name mysql5.7 -e MYSQL_ROOT_PASSWORD=root -p 3306:3306 --volumes-from data-volume mysql:5.7

Container to create:

third step:

Creating nginx container, enter the command:

docker run -d --name nginx  -p 80:80 --volumes-from data-volume nginx 

Container to create:

 

Thus, the use of volumes-from the completion of the data volume mount directory

Released five original articles · won praise 0 · Views 246

Guess you like

Origin blog.csdn.net/weixin_32822759/article/details/105219617