docker / hub-feedback

Feedback and bug reports for the Docker Hub
https://hub.docker.com
233 stars 48 forks source link

docker export container changes files ownership/groupship to root #2338

Closed ezplanet closed 10 months ago

ezplanet commented 10 months ago

Problem description

When I export a container with

docker export mycontainer -o mycontainer.tar

the ownership of the files is changed to root.

For example I have a container running postfix that in turns requires to run under its own user ID, also there are executables using setgid. When I backup the container using docker export as above and then I restore the image (or tar xpf the save tar file), every file that is supposed to belong to postfix is changed to root ownership therefore container created from the restored image is thus corrupted and postfix fails to start.

The last time an export was created correctly it was 29/07/2023, after that my Ubuntu 22.04.3 LTS distribution received a few updates and I found that backups created after have the ownership of postfix files changed to root.

docker info output

Docker Info:

Client:
 Context:    default
 Debug Mode: false

Server:
 Containers: 2
  Running: 2
  Paused: 0
  Stopped: 0
 Images: 2
 Server Version: 20.10.25
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: systemd
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version:
 runc version:
 init version:
 Security Options:
  apparmor
  seccomp
   Profile: default
  cgroupns
 Kernel Version: 5.15.0-79-generic
 Operating System: Ubuntu 22.04.3 LTS
 OSType: linux
 Architecture: x86_64
 CPUs: 4
 Total Memory: 15.28GiB
 Name: levante
 ID: ORRH:Z6FU:SC6U:PFZ7:UDAU:YWBS:3X7H:QG6I:BMJW:EIX7:N5UL:2NOK
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

Debug Information

Browser name and version:

URL: n/a

Timetamp or time range:

Public IP:

Hub Username:

Error messages (on screen or in browser console)

Screenshots of the issue (if applicable)

Task List

milosgajdos commented 10 months ago

This repo is for reporting issues in Docker Hub. I'd recommend asking in https://github.com/moby/moby.

I'm closing this issue now, but please feel free to reopen it if you think your problem is related to Docker Hub.