I am trying to understand exactly how a named volume works in the following example from docker docs :
version: "3" services: db: image: db volumes: #1 - data-volume:/var/lib/db backup: image: backup-service volumes: #2 - data-volume:/var/lib/backup/data volumes: data-volume:
I assume that the first occurrence of the named volume (# 1) determines what is contained within the volume, and subsequent occurrences (# 2) simply share the contents of the volume with any containers to which they refer.
Is this assumption correct?
Listing data-volume:under a volumes:top-level key creates a named volume on the host, if it does not already exist. This behaves as follows according to this source.
data-volume:
volumes:
, docker -v my-valu-data:/data imageName, / / ., , / /, .docker / . " " [volume-name] ".
, docker -v my-valu-data:/data imageName, / / .
, , / /, .
, , , ( ). , (althoug, , ), depend_on,
-------------------
depend_on 3.
, .
- , , .
, . ( , ):
version: "3" services: db: image: db volumes: #1 uses the named and shared volume 'data-volume' created with #3 - data-volume:/var/lib/db backup: image: backup-service volumes: #2 uses the named and shared volume 'data-volume' created with #3 - data-volume:/var/lib/backup/data volumes: #3 creates the named volume 'data-volume' data-volume:
(, , , ). .
Source: https://habr.com/ru/post/1674179/More articles:Matplotlib: label tags do not match font setting (LaTeX example text) - pythonОриентация аудитории на Liferay - liferayhow to use gitlab repo in NPM with package. json - gitlabF # is type obj, but I want 'a - listF # Convert 'discriminated union to string - f #MKLocalSearch does not give the same results as searches in the Apple Maps app - ios"npm install" gives the error message "invalid", what is it? - npmMultiple class definition - c ++Update npm package with fixed dependency from command line - npmEA Connector Creation - enterprise-architectAll Articles