Skip to content

File UIDs/GIDs from host leak into imave via ADD #2684

@crashsystems

Description

@crashsystems

When files are injected into an image via ADD in a Dockerfile, those files have the same UID/GID as what they had on the host. Recently, when building an image in a testing environment, this caused no problems. However, I then deployed it on a server, with a user that happened to have a different UID. This cause the application in the container to crash.

This problem is easy enough to avoid once you know about it, but it seems like a small detail of the host leaking into the container.

A solution I think would work would be to make the injected files assume the UID/GID of the user under which commands are running at that point in the Dockerfile. So by default it would be root, but if ADD is preceded by a USER command, the files would assume the ownership of the specified user.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions