Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: temporarily move rw mounts during image build #187

Closed
johnstcn opened this issue May 14, 2024 · 1 comment
Closed

feat: temporarily move rw mounts during image build #187

johnstcn opened this issue May 14, 2024 · 1 comment
Assignees

Comments

@johnstcn
Copy link
Member

johnstcn commented May 14, 2024

          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 #183 (comment)

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 #183 to include all volumes mounted in?

@johnstcn johnstcn changed the title feat: handle rw mounts feat: temporarily move rw mounts during image build May 14, 2024
@mtojek mtojek assigned mtojek and johnstcn and unassigned mtojek Aug 29, 2024
@johnstcn johnstcn removed their assignment Oct 28, 2024
@DanielleMaywood
Copy link
Contributor

I'm unable to reproduce the behaviour mentioned.

Attempting to reproduce this on our dogfood instance

$ docker --version
Docker version 27.3.0, build e85edf8
$ ls /home/coder/casts
new-cliui-select      new-prompt-multiple      new-prompt-rich-parameter  new-roles-edit       no-blink               original-create-workspace  original-prompt-multi-select    original-prompt-select  original-template-delete
new-create-workspace  new-prompt-multi-select  new-prompt-select          new-template-delete  original-cliui-select  original-prompt-multiple   original-prompt-rich-parameter  original-roles-edit

$ docker run --rm -it \
    -v /home/coder/casts/:/opt/casts:rw \
    -e ENVBUILDER_GIT_URL=https://github.com/coder/envbuilder-starter-devcontainer \
    -e ENVBUILDER_INIT_SCRIPT=bash \
    envbuilder:latest

devcontainer # ls /opt/casts/
new-cliui-select      new-prompt-multi-select  new-prompt-rich-parameter  new-roles-edit       no-blink               original-create-workspace     original-prompt-multiple        original-prompt-select  original-template-delete
new-create-workspace  new-prompt-multiple      new-prompt-select          new-template-delete  original-cliui-select  original-prompt-multi-select  original-prompt-rich-parameter  original-roles-edit

devcontainer # exit

$ ls /home/coder/casts
new-cliui-select      new-prompt-multiple      new-prompt-rich-parameter  new-roles-edit       no-blink               original-create-workspace  original-prompt-multi-select    original-prompt-select  original-template-delete
new-create-workspace  new-prompt-multi-select  new-prompt-select          new-template-delete  original-cliui-select  original-prompt-multiple   original-prompt-rich-parameter  original-roles-edit

Attempting to reproduce this on a Ubuntu 24.04 VM

$ docker --version
Docker version 27.3.1, build ce12230
$ ls /tmp/important
a  b  c

$ docker run --rm -it \
    -v /tmp/important:/opt/important:rw \
    -e ENVBUILDER_GIT_URL=https://github.com/coder/envbuilder-starter-devcontainer \
    -e ENVBUILDER_INIT_SCRIPT=bash \
    ghcr.io/coder/envbuilder:latest

devcontainer # ls /opt/important/
a  b  c

devcontainer # exit

$ ls /tmp/important
a  b  c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants