Docker data volume container creation and usage analysis

Docker data volume container creation and usage analysis

A data volume container is a container specifically used to mount data volumes. This container is mainly referenced and used by other containers. The so-called data volume container is actually an ordinary container, as shown below:

Create a data volume container

Create a data volume container using the following method:

docker run -itd -v /usr/share/nginx/html/ --name mydata ubuntu

The command execution effect is as follows:

Reference Container

Use the following command to reference the data volume container:

docker run -itd --volumes-from mydata -p 80:80 --name nginx1 nginx
docker run -itd --volumes-from mydata -p 81:80 --name nginx2 nginx

At this point, nginx1 and nginx2 both mount the same data volume to the /usr/share/nginx/html/ directory. If any of the three containers is modified,

The files in this directory can be seen in the other two.

At this point, use the docker inspect command to view the details of the container and find that the descriptions of the data volumes of the three containers are consistent, as shown below:

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • Steps to set up and mount shared folders on Windows host and Docker container
  • Docker deploys nginx and mounts folders and file operations
  • Docker mounts local directories and data volume container operations

<<:  JavaScript to achieve uniform animation effect

>>:  How to dynamically modify the replication filter in mysql

Recommend

HTML uses canvas to implement bullet screen function

Introduction Recently, I needed to make a barrage...

How to successfully retrieve VMware Esxi root password after forgetting it

Prepare a CentOS6 installation disk (any version)...

Design theory: Why are we looking in the wrong place?

I took the bus to work a few days ago. Based on m...

How to configure multiple tomcats with Nginx load balancing under Linux

The methods of installing nginx and multiple tomc...

Detailed explanation of the simple use of MySQL query cache

Table of contents 1. Implementation process of qu...

Pitfalls and solutions encountered in MySQL timestamp comparison query

Table of contents Pitfalls encountered in timesta...

MySQL 5.7.18 version free installation configuration tutorial

MySQL is divided into installation version and fr...

The linkage method between menu and tab of vue+iview

Vue+iview menu and tab linkage I am currently dev...

Analysis of basic usage of ul and li

Navigation, small amount of data table, centered &...

Start a local Kubernetes environment using kind and Docker

introduce Have you ever spent a whole day trying ...

Summary of the characteristics of SQL mode in MySQL

Preface The SQL mode affects the SQL syntax that ...

Common naming rules for CSS classes and ids

Public name of the page: #wrapper - - The outer e...

MySQL SQL statement performance tuning simple example

MySQL SQL statement performance tuning simple exa...

MySQL trigger syntax and application examples

This article uses examples to illustrate the synt...