Hi,
This is the expected behavior for an existing volume. What I want is for a brand new volume to be populated with the initial contents of /projects.
The documentation here
https://docs.docker.com/storage/volumes/ clearly says that when a volume is created, the contents of the directory to be mounted is cloned to the volume.
From there on, content of the volume will be the only content. And the original contents of /projects are hidden, which is the traditional behavior of Unix mount
This is exactly what I want.
But I have not been able to get the initial contents of /projects to be cloned to the volume. Either I missed something or the Docker documentation on volume
is not correct.
Son Nguyen
From: che-dev-bounces@xxxxxxxxxxx [mailto:che-dev-bounces@xxxxxxxxxxx]
On Behalf Of Mario
Sent: Monday, March 18, 2019 5:21 AM
To: che developer discussions
Subject: Re: [che-dev] Ruunig Che and Che worksapce as non root user.
The goal is to have the content of the main container’s /projects shared between the main container
and its sidecars.
https://docs.docker.com/storage/volumes/
indicates that it is possible to do so but it did not work for me.
I created an image, added /projects and some contents under the directory. But once the workspace is
up and running the contents do not appear in /projects.
As already pointed out by Serhii that's not how volumes work unfortunately. If you mount /projects, the original image /projects folder content will be replaced with the content of the volume.
A simple example of the content of the /var/ folder in a fedora container (original content and contente when mounted):
~ $ docker run -ti --rm fedora ls /var/
adm db ftp gopher lib lock mail opt run tmp
cache empty games kerberos local log nis preserve spool yp
~ $ docker run -ti --rm -v ~/newdir:/var/ fedora ls /var/