envbuilder icon indicating copy to clipboard operation
envbuilder copied to clipboard

feat: temporarily move rw mounts during image build

Open johnstcn opened this issue 1 year ago • 0 comments

          This is an interesting question, should we or should we not limit this to read-only mounted filesystems? If we think about how a docker container is run with `-v /path:/path`, the contents of the docker container can never populate the mounted `/path`.

Originally posted by @mafredri in https://github.com/coder/envbuilder/pull/183#discussion_r1598536663

Currently, mounting in read-write volumes results in their contents not being available inside the container:

$ echo 'important stuff' >> /opt/important-stuff/tps-reports.txt
$ ls -l /opt/important-stuff/tps-reports.txt 
-rw-r--r-- 1 cian 16 May 13 21:12 /opt/important-stuff/tps-reports.txt
$ docker run -it --rm \
    -v /opt/important-stuff:/opt/important-stuff \
    -e GIT_URL=https://github.com/coder/envbuilder-starter-devcontainer \
    -e INIT_SCRIPT=bash \
    envbuilder:latest
[...]
devcontainer # ls -l /opt/important-stuff/
total 0
devcontainer # exit
$ cat /opt/important-stuff/tps-reports.txt
important stuff

Can we extend https://github.com/coder/envbuilder/pull/183 to include all volumes mounted in?

johnstcn avatar May 14 '24 10:05 johnstcn