5.7 C
New York
Thursday, November 14, 2024

Docker tutorial: Get began with Docker volumes



Utilizing the Docker quantity API

A greater resolution to the issue is to make use of Docker’s quantity API to create named volumes. Named volumes will be simply hooked up to a number of containers, and thus reused a great deal extra simply.


$ docker quantity create websvcdata

This creates a Docker quantity named websvcdata. Nevertheless, the Docker quantity doesn’t have a mount level in a container but, so a container wouldn’t be capable of entry it by default. To create a mount level, you’d launch the container with a command like this:


$ docker run -P —identify websvc -v websvcdata:/websvcdata myorg/websvc python app.py

This command is similar because the earlier docker run instance, however as a substitute of the amount being created with an nameless identify, it’s created with the identify websvcdata on the host. You may run docker examine on the container and browse the "Mounts" part within the ensuing dump to find out if the mounts are as you supposed.



Supply hyperlink

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles