A recent project to use Data Volume, here is a simple record.Data volumes can be used to store data for Docker applications, or to share data between Docker containers. A data volume is presented to a Docker container in the form of a directory that supports sharing between
Before deploying the Linux deployment Docker record (0)-Infrastructure installation, next look at the use of Docker volume.Docker Volume use1) A data volume is a specially specified directory that leverages the container's UFS file system to provide some stable features or data sharing for the container. A data
How can I dynamically bind a Volume group to a running Docker container and dynamically add Volume ?, Dockervolume
How can I dynamically bind a Volume group to a running Docker container and dynamically add Volume?
Requirement:
shared and reused between containers;
Changes to the data volume will be effective immediately;
Updates to the data volume do not affect mirroring;
The volume will always exist until no container is used.
The use of a data volume, similar to the mount operatio
Docker data volumesA data volume is a specially crafted directory that can bypass the federated file System (UFS) and provide access to one or more containersFeatures of the data volume:The data volume is initialized when the container starts, and if the image used by the container contains data at the mount point, the
struct in Docker daemon. It then iterates through all of the mount points and registers all of the mount point information in the current container structure.
2. User-specified bindings mount: User-specified binding mounts can be in the format of source path:destination path or name:destination path. If the user e
foo:foo/dataThe Docker file runs as expected, and we would have liked totouchThe command runs on the mirrored file system, but in fact it runs on the volume of a temporary container. As shown below:From Debian:wheezyrun useradd foorun mkdir/data touch/data/xrun chown-r foo:foo/datavolume/dataDocker can mount the files under
directly on the host. Any files in the/data path of the image will be copied to volume. We can use the Docker inspect command to find where the volume is stored on the host:
$ docker inspect-f {{. Volumes}} container-test
You will see a similar output:
MAP[/DATA:/VAR/LIB/DOC
/cde167197ccc3e13814f...b32ce9059437a9/test-file
into our container you can see:
$ root@container:/# ls/data
test-file
As long as the directory of the host is attached to the directory of the container, the change takes effect immediately. We can achieve the same purpose in Dockerfile by using the VOLUME directive:
From Debian:wheezy
Volume/data
But there is another thing that only the-v parameter
mechanism for associating a directory on a host with a container's directory (called a mount point, or volume), and the content under the container's mount point is the contents of the host directory, similar to the Linux system mount mechanism. In this case, when we modify the contents of the directory on the host, w
Docker Volume use
A data volume is a specially specified directory that leverages the container's UFS file system to provide some stable features or data sharing for the container. A data volume can be shared among multiple containers.
To create a data volume, you can crea
Recently, because of the work, various things, busy to die. The user found that the software has a problem, and whether it is not their own operation of the problem, a mouthful of convinced that is a software problem, ask what question when "there is a problem" three word response is also drunk.It's never been said before. Docker saw the data volume container as if it was useful to know what the data
Mount, back up, and restore data.To create a centralized volume group:Docker run--name dbdata-v/dbdata centos7:file Echo " data-only container for MySQL. " Mount using:Docker Run-rt--volumes-from dbdata Centos7:tar/bin/bashCd/dbdataTouch AA bb cc DB3:AABackup:[email protected] backup]# Docker run--name backup-file-d--v
=" "/>"9, now to complete the two volume way, summed up:
A, the volume mount created by Dockerfile is actually a mount point created under Dockerhost
B, through-V and mapping the path, a bit like direct-attached storage, directly map the host's volume
Original: http://my.oschina.net/piorcn/blog/324202Docker can support mounting a directory on a host to a mirrorDocker Run-it-v/home/dock/downloads:/usr/downloads Ubuntu64/bin/bashWith the-v argument, the colon is preceded by a host directory, which must be an absolute path, followed by a colon after the path that is mounted inside the mirror.The files in the host can now be shared within the image.The default mount path permission is read-write. If sp
:0px;background-image:none; "/>2. Then we write a dockerfile, and in which we specify volume:650) this.width=650; "title=" image "border=" 0 "alt=" image "src=" http://vmcloud.info/wp-content/uploads/2016/05/ Image_thumb-2.png "Width=" 309 "height=" 267 "style=" Border:0px;height:auto;padding-top:0px;padding-left:0px;margin : 0px;padding-right:0px;background-image:none; "/>3. We then use the Docker file to
1, when running the container, add privileges to the container:Example: Docker run-i-T--privileged=true-v/home/docs:/src waterchestnut/nodejs:0.12.02. Temporarily close SELinux:Example: Su-c "Setenforce 0"After execution: Docker run-i-t-v/home/docs:/src waterchestnut/nodejs:0.12.0Note: Remember to re-open SELinux, command: su-c "Setenforce 1"3. Add the SELinux rule to add the directory you want to
Docker Data Volume permissions
Run the Nodejs container in CentOS7, find the mounted local directory does not execute permissions in the container, after various authentication and Google search, found the cause of the problem, here to do a record. The reason is that the security module in CentOS7 selinux the permissions, at least in the following three ways to solve the problem of a mounted directory with
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.