devcontainers / spec

Development Containers: Use a container as a full-featured development environment.
https://containers.dev
Creative Commons Attribution 4.0 International
3.36k stars 206 forks source link

Need solution for running dev container with rootless Docker #479

Open jcr010910 opened 1 month ago

jcr010910 commented 1 month ago

Writing to the host filesystem fails unless the container is run with root privileges.

Steps to Reproduce:

  1. Set up rootless Docker environment (dockerd-rootless-setuptool.sh install)
  2. Start a development container (docker run ...)
  3. Attempt to write files from the container to the host filesystem (echo "test" > /host/path/file.txt)

Expected Behavior: Files should be written successfully to the host filesystem without needing to run the container as root.

timsu92 commented 1 month ago

Did you try to alter file permissions? Like using chmod?

samruddhikhandale commented 1 month ago

To write files from a rootless Docker container to the host filesystem, you need to ensure that the user inside the container has the necessary permissions to write to the specified directory on the host. Here are the steps to achieve this:

@jcr010910 Which image are you using? The images hosted from https://github.com/devcontainers/images have ^ configured to support rootless docker.