Skip to content

About the Permission for docker container auto create directory [Bug]: [Docs]:  #5270

Closed as not planned
@dxkrs

Description

@dxkrs

Is there an existing issue for this?

  • I have searched the existing issues

OS/Web Information

  • Web Browser: Chrome
  • Local OS: macOS
  • Remote OS:Centos7
  • Remote Architecture: amd64
  • code-server --version:codercom/code-server:4.4.0
  • Docker Version:docker-ce 20.10.17

Steps to Reproduce

Follow the install manua for Docker ,my container run command:

docker run -it --name code-server -p 127.0.0.1:8080:8080 \
  -v /home/vsc/.config/code-server:/home/coder/.config/code-server \
  -v /home/vsc/myproject:/home/coder/project \
  -u 1001:1001 \
  -e DOCKER_USER=vsc \
  codercom/code-server:latest

Expected

I want to create or edit my code project file in /home/coder/project, but it will tips permission defined in Browser.

Actual

I have done some research for this promble.

The codercom/code-server:latest images not exists the directory /home/coder/project, docker will auto create this directory when the containter init, but the uid (and gid) isn't follow the env DOCKER_USER (or -u option ) which auto docker auto create, so these auto create directory or file only read on the code-server running.

The issue #4166 and #1191 look like the same problem, and the #1191 maybe is a way to fix, which is create the directory when the images build (use dockerfile). I'm not suer it is a good way because of the users maybe want to set other customer directory or file persistently, such as project directory, user-data-dir, extensions-dir.

Anyways, the install manual for Docker -v "$PWD:/home/coder/project" \ is not useful unless the images have the /home/coder/project.

During my research, I found the other images linuxserver/code-server,which is referenced in the install manua for Docker for arm32 support. This images is very different from the codercom/code-server, and the important is it has the /config directory, which is ready for the workspace directory ,user-data-dir, extensions-dir, and I can mount these path on the host machine. It is very useful and nice!

Finally, I found that any directory or file which I mount on the container from linuxserver/code-server, it will auto be changed for abc uid and abc gid, which is the default runing user for the container. I think maybe can do something on image buliding for learning this point?

Logs

No response

Screenshot/Video

No response

Does this issue happen in VS Code or GitHub Codespaces?

  • I cannot reproduce this in VS Code.
  • I cannot reproduce this in GitHub Codespaces.

Are you accessing code-server over HTTPS?

  • I am using HTTPS.

Notes

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriageThis issue needs to be triaged by a maintainer

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions