Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Usability issue with distroless user's lack of home directory #4083

Closed
Assignees
mthalman
Labels
area-dockerfilesConcerns the official .NET Dockerfiles or Dockerfile templates
@mthalman

Description

@mthalman

In our distroless Dockerfiles, we create a non-root user in order to have things run without root privileges by default. When this was first defined, it was thought that a home directory for this user was unnecessary.

But there are some usability issues with not having a home directory. Some Linux tools, and perhaps the .NET application code itself, may expect that a home directory exists for the user.

For example, the docker CLI has functionality which will attempt to write to the$HOME/.docker/config.json path. When it attempts to create the/home/app directory in a .NET distroless container, it gets the following error:Error saving credentials: mkdir /home/app: permission denied.

As a result of not having this home directory by default, developers wishing to have one must resort to configuring it in their own Dockerfile which is made even more complicated by the fact that you can't create the directory directly in the distroless stage (due to no shell). By having a multi-stage Dockerfile with a staging directory, the workaround would look like this:

RUN homeDir="/staging/home/app" \    && mkdir -p $homeDir \    && chown -R app $homeDir

This issue proposes that the distroless Dockerfiles should be configured to create a home directory for the non-root user.

Metadata

Metadata

Assignees

Labels

area-dockerfilesConcerns the official .NET Dockerfiles or Dockerfile templates

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp