Docker Community Forums

Share and learn in the Docker community.

Cannot change UID/GID on files in a docker volume


(Wispmax) #1

Expected behavior

Inside the container I shall be able to change file’s owner with a chown, even if this file is in a docker volume.

Actual behavior

Files can be chown only if they are not in a directory bind to a docker volume.

Information

  • the output of:
    • pinata diagnose -u on OSX
      ➜ ~ pinata diagnose -u OS X: version 10.11.4 (build: 15E65) Docker.app: version v1.11.0-beta8.2 Running diagnostic tests: [OK] docker-cli [OK] Moby booted [OK] driver.amd64-linux [OK] vmnetd [OK] osxfs [OK] db [OK] slirp [OK] menubar [OK] environment [OK] Docker [OK] VT-x Docker logs are being collected into /tmp/20160422-150435.tar.gz Most specific failure is: No error was detected Your unique id is: 3E942593-9D69-4C96-A124-D9C105158E73 Please quote this in all correspondence.

Steps to reproduce the behavior

  1. Run gitlab this way : docker run --detach --publish 443:443 --publish 80:80 --publish 22:22 --name d_gitlab --restart always --volume /Users/me/dockerdata/gitlab/config:/etc/gitlab --volume /Users/me/dockerdata/gitlab/logs:/var/log/gitlab --volume /Users/me/dockerdata/gitlab/data:/var/opt/gitlab gitlab/gitlab-ce:latest

  2. Enter docker with docker exec -it d_gitlab bash

  3. Try to change owner
    cd /var/opt/gitlab/git-data/repositories/ touch toto ls -l ==> -rw-r--r-- 1 root root 0 Apr 22 12:59 toto chown git toto ls -l ==> -rw-r--r-- 1 root root 0 Apr 22 12:59 toto

Same steps with a file which is not in a docker volume work properly.

This issue seems similar to New file sharing UID/GID permissions break image portability.


(David Sheets) #2

A new ownership model was introduced in Beta 11. Please let us know if it satisfies your use case.

Thanks,

David Sheets