Go: Docker Learning---mount a local directory

Source: Internet
Author: User

Original: http://my.oschina.net/piorcn/blog/324202

Docker can support mounting a directory on a host to a mirror

Docker Run-it-v/home/dock/downloads:/usr/downloads Ubuntu64/bin/bash

With 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 specified as read-only can be used: RO

Docker Run-it-v/home/dock/downloads:/usr/downloads:ro Ubuntu64/bin/bash

Docker also provides a high level of usage. Called a data volume.

Data volume: "In fact, it is a normal container dedicated to providing data volumes for other containers to mount." It feels like a data-mount message defined by a container. Other container launches can be mounted directly to mount information defined in the data volume container.

See Example:

Docker run-v/home/dock/downloads:/usr/downloads  --name datavol Ubuntu64/bin/bash

Create a common container. Use--name to give him a name (a random name is generated if you don't specify it).

Create a new container to use this data volume.

Docker run-it--volumes-from Datavol Ubuntu64/bin/bash

The--volumes-from is used to specify which data volume to mount data from.

Go: Docker Learning---mount a local directory

Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.