You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am working on a docker file to create a flutter development environment and learn docker containers. In the process, I stumbled across an incident where docker does not seem to do what it is supposed to, according to manuals.
I am trying to add android-studio.tar tarball into the image and I expect the owner of the target directory to be the one I used in the ADD command's --chown parameter. However it still looks like root.
Reproduce
Here is my rather simple docker file:
FROM eclipse-temurin:17-noble
SHELL ["/bin/bash", "-c"]
#create a non-root user and use it
RUN useradd --base-dir /home --create-home --shell /bin/bash flutter_dev
# surpress "debconf: unable to initialize frontend: Dialog" error messages
ENV DEBIAN_FRONTEND=noninteractive
USER flutter_dev
# ADD --chown=1001:1001 --chmod=766 android-studio-2024.2.2.15-linux.tar.gz /tmp
ADD --chown=flutter_dev:flutter_dev --chmod=766 android-studio-2024.2.2.15-linux.tar.gz /tmp
PS: I tried both UID:GUID and username:groupsname formats. Outcome is still the same.
I expect android-studio folder to be owned by flutter_dev:flutter_dev as defined in Docker manual:
All files and directories copied from the build context are created with a UID and GID of 0 unless the optional --chown flag specifies a given username, groupname, or UID/GID combination to request specific ownership of the copied content. The format of the --chown flag allows for either username and groupname strings or direct integer UID and GID in any combination. Providing a username without groupname or a UID without GID will use the same numeric UID as the GID. If a username or groupname is provided, the container's root filesystem /etc/passwd and /etc/group files will be used to perform the translation from name to integer UID or GID respectively
docker version
Client:
Version: 28.0.0
API version: 1.48
Go version: go1.24.0
Git commit: f9ced58158
Built: Mon Feb 24 21:55:48 2025
OS/Arch: linux/amd64
Context: default
Server:
Engine:
Version: 28.0.0
API version: 1.48 (minimum version 1.24)
Go version: go1.24.0
Git commit: af898abe44
Built: Mon Feb 24 21:55:48 2025
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: v2.0.3
GitCommit: 06b99ca80cdbfbc6cc8bd567021738c9af2b36ce.m
runc:
Version: 1.2.5
GitCommit:
docker-init:
Version: 0.19.0
GitCommit: de40ad0
Description
I am working on a docker file to create a flutter development environment and learn docker containers. In the process, I stumbled across an incident where docker does not seem to do what it is supposed to, according to manuals.
I am trying to add android-studio.tar tarball into the image and I expect the owner of the target directory to be the one I used in the ADD command's --chown parameter. However it still looks like root.
Reproduce
PS: I tried both UID:GUID and username:groupsname formats. Outcome is still the same.
5.result
Expected behavior
I expect android-studio folder to be owned by flutter_dev:flutter_dev as defined in Docker manual:
All files and directories copied from the build context are created with a UID and GID of 0 unless the optional --chown flag specifies a given username, groupname, or UID/GID combination to request specific ownership of the copied content. The format of the --chown flag allows for either username and groupname strings or direct integer UID and GID in any combination. Providing a username without groupname or a UID without GID will use the same numeric UID as the GID. If a username or groupname is provided, the container's root filesystem /etc/passwd and /etc/group files will be used to perform the translation from name to integer UID or GID respectively
docker version
Client: Version: 28.0.0 API version: 1.48 Go version: go1.24.0 Git commit: f9ced58158 Built: Mon Feb 24 21:55:48 2025 OS/Arch: linux/amd64 Context: default Server: Engine: Version: 28.0.0 API version: 1.48 (minimum version 1.24) Go version: go1.24.0 Git commit: af898abe44 Built: Mon Feb 24 21:55:48 2025 OS/Arch: linux/amd64 Experimental: false containerd: Version: v2.0.3 GitCommit: 06b99ca80cdbfbc6cc8bd567021738c9af2b36ce.m runc: Version: 1.2.5 GitCommit: docker-init: Version: 0.19.0 GitCommit: de40ad0
docker info
Additional Info
Host environment:
CPU: quad core 11th Gen Intel Core i5-1135G7 (-MT MCP-)
speed/min/max: 400/400/4200 MHz Kernel: 6.6.80-1-MANJARO x86_64 Up: 1h 35m
Mem: 3.03/15.35 GiB (19.7%) Storage: 476.94 GiB (36.0% used) Procs: 263
Shell: Zsh inxi: 3.3.37
LSB Version: n/a
Distributor ID: ManjaroLinux
Description: Manjaro Linux
Release: 25.0.0
Codename: Zetar
Currently running:6.6.80-1-MANJARO (linux66)
The following kernels are installed in your system:
The text was updated successfully, but these errors were encountered: