New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chown has no affect for mounted volumes #39

Closed
ptrewhella opened this Issue Aug 17, 2016 · 30 comments

Comments

Projects
None yet
@ptrewhella

ptrewhella commented Aug 17, 2016

Expected behavior

Directory owner can be changed with chown within the container for mounted volumes.

Actual behavior

Using chown within the container for a mounted volume does nothing.

Information

  • Diagnostic ID from "Diagnose & Feedback" in the menu.
  • Windows 10 Pro, Docker 1.12.0-beta21 (build 5971) - also tried stable release

Steps to reproduce the behavior

  1. C:\Users\sotera>docker run --rm -v c:\users\sotera\docker\sotera:/var/lib/postgresql/data postgres /bin/bash -c "chown postgres:postgres /var/lib/postgresql/data && ls -lh /var/lib/postgresql/"

    total 4.0K drwxr-xr-x 2 root root 4.0K Aug 16 23:29 data

@ptrewhella

This comment has been minimized.

Show comment
Hide comment
@ptrewhella

ptrewhella Aug 17, 2016

Here is a similar command executed on my Mac. Notice the owner is changed to postgres:postgres.

iridium:rt ptrewhella$ docker run --rm -v /Users/ptrewhella/data:/var/lib/postgresql/data postgres /bin/bash -c "chown postgres:postgres /var/lib/postgresql/data && ls -lh /var/lib/postgresql"

total 512 drwxr-xr-x 2 postgres postgres 68 Aug 17 00:23 data iridium:rt ptrewhella$

ptrewhella commented Aug 17, 2016

Here is a similar command executed on my Mac. Notice the owner is changed to postgres:postgres.

iridium:rt ptrewhella$ docker run --rm -v /Users/ptrewhella/data:/var/lib/postgresql/data postgres /bin/bash -c "chown postgres:postgres /var/lib/postgresql/data && ls -lh /var/lib/postgresql"

total 512 drwxr-xr-x 2 postgres postgres 68 Aug 17 00:23 data iridium:rt ptrewhella$

@ptrewhella

This comment has been minimized.

Show comment
Hide comment
@ptrewhella

ptrewhella Aug 29, 2016

This behavior renders the PostgreSQL container pretty much useless on a Windows host, because it will not run as user root, and it will not run unless the user under which the process is running owns the files.

ptrewhella commented Aug 29, 2016

This behavior renders the PostgreSQL container pretty much useless on a Windows host, because it will not run as user root, and it will not run unless the user under which the process is running owns the files.

@dgageot

This comment has been minimized.

Show comment
Hide comment
@dgageot

dgageot Sep 9, 2016

@ptrewhella I haven't tried it but Beta25 brings some changes to the file mounting. There's a slight chance that it might help. Could you give it a try?

dgageot commented Sep 9, 2016

@ptrewhella I haven't tried it but Beta25 brings some changes to the file mounting. There's a slight chance that it might help. Could you give it a try?

@ptrewhella

This comment has been minimized.

Show comment
Hide comment
@ptrewhella

ptrewhella Sep 9, 2016

@dgageot Yes, sure I'll try it now. Thanks.

ptrewhella commented Sep 9, 2016

@dgageot Yes, sure I'll try it now. Thanks.

@ptrewhella

This comment has been minimized.

Show comment
Hide comment
@ptrewhella

ptrewhella Sep 9, 2016

@dgageot Just updated and ended up with the same results (root:root) after chown.

ptrewhella commented Sep 9, 2016

@dgageot Just updated and ended up with the same results (root:root) after chown.

@otravers

This comment has been minimized.

Show comment
Hide comment
@otravers

otravers Sep 16, 2016

I can replicate this behavior as of Docker for Windows 1.12.1-stable (b7135). I tried Chowning via docker exec, and via bash.

otravers commented Sep 16, 2016

I can replicate this behavior as of Docker for Windows 1.12.1-stable (b7135). I tried Chowning via docker exec, and via bash.

@sameronline

This comment has been minimized.

Show comment
Hide comment
@sameronline

sameronline Dec 30, 2016

I still can replicate this behavior on 1.12.5 (9503) stable

sameronline commented Dec 30, 2016

I still can replicate this behavior on 1.12.5 (9503) stable

@friism

This comment has been minimized.

Show comment
Hide comment
@friism

friism Mar 10, 2017

Unfortunately, with the current implementation (based on CIFS/Samba) we can't improve this.

Attempting to change these values via chmod/chown will return success but have no effect.

https://www.samba.org/samba/docs/man/manpages-3/mount.cifs.8.html#id2532725

I'm leaving this issue open for tracking.

friism commented Mar 10, 2017

Unfortunately, with the current implementation (based on CIFS/Samba) we can't improve this.

Attempting to change these values via chmod/chown will return success but have no effect.

https://www.samba.org/samba/docs/man/manpages-3/mount.cifs.8.html#id2532725

I'm leaving this issue open for tracking.

@glinton

This comment has been minimized.

Show comment
Hide comment
@glinton

glinton May 18, 2017

Are there plans, if it's not already a thing, to be able to specify what user to mount the volume as? I see in that manpage link from above that setting uid and gid could essentially serve the same purpose as chowning.

Edit: Just realized I was re-proposing #63. Keeping comment here since that was closed prematurely

glinton commented May 18, 2017

Are there plans, if it's not already a thing, to be able to specify what user to mount the volume as? I see in that manpage link from above that setting uid and gid could essentially serve the same purpose as chowning.

Edit: Just realized I was re-proposing #63. Keeping comment here since that was closed prematurely

@friism

This comment has been minimized.

Show comment
Hide comment
@friism

friism May 18, 2017

@glinton there's not a simple way to do that unfortunately. Host volume mounting on Windows 10 is done with a unitary mount of the whole drive so supporting different mappings for various mounts is not an option.

friism commented May 18, 2017

@glinton there's not a simple way to do that unfortunately. Host volume mounting on Windows 10 is done with a unitary mount of the whole drive so supporting different mappings for various mounts is not an option.

@glinton

This comment has been minimized.

Show comment
Hide comment
@glinton

glinton May 18, 2017

Hmm, even being able to change the uid/gid of that single mount would be quite useful to at least myself (and team). It seems like it would have to be configured elsewhere (rather than as an option to -v) as it would impact all mounts, as you mentioned. That is, if it was to be implemented at all.

glinton commented May 18, 2017

Hmm, even being able to change the uid/gid of that single mount would be quite useful to at least myself (and team). It seems like it would have to be configured elsewhere (rather than as an option to -v) as it would impact all mounts, as you mentioned. That is, if it was to be implemented at all.

@GitSage

This comment has been minimized.

Show comment
Hide comment

GitSage commented Oct 9, 2017

@Johlandabee

This comment has been minimized.

Show comment
Hide comment
@Johlandabee

Johlandabee Jan 19, 2018

I get the same behavior with 18.01.0-ce on Windows 10 1709 (16299.192) using LCOW.

Unfortunately, with the current implementation (based on CIFS/Samba) we can't improve this.

@friism Will it eventually improve with LCOW?

Johlandabee commented Jan 19, 2018

I get the same behavior with 18.01.0-ce on Windows 10 1709 (16299.192) using LCOW.

Unfortunately, with the current implementation (based on CIFS/Samba) we can't improve this.

@friism Will it eventually improve with LCOW?

@friism

This comment has been minimized.

Show comment
Hide comment
@friism

friism Jan 19, 2018

@Johlandabee I hope so! @jstarks would have the details

friism commented Jan 19, 2018

@Johlandabee I hope so! @jstarks would have the details

@solody

This comment has been minimized.

Show comment
Hide comment
@solody

solody Jan 21, 2018

my god, big bug, what to do ...

solody commented Jan 21, 2018

my god, big bug, what to do ...

@los93sol

This comment has been minimized.

Show comment
Hide comment
@los93sol

los93sol Jan 29, 2018

Any update?

los93sol commented Jan 29, 2018

Any update?

@los93sol

This comment has been minimized.

Show comment
Hide comment
@los93sol

los93sol Feb 5, 2018

Any update?

los93sol commented Feb 5, 2018

Any update?

@rickbutton

This comment has been minimized.

Show comment
Hide comment
@rickbutton

rickbutton Feb 6, 2018

Is there any update to this? It seems like it is more or less impossible to run certain linux containers on a windows host...

rickbutton commented Feb 6, 2018

Is there any update to this? It seems like it is more or less impossible to run certain linux containers on a windows host...

@mkelandis

This comment has been minimized.

Show comment
Hide comment
@mkelandis

mkelandis Feb 12, 2018

+1... blocker for windows. would appreciate any information on workarounds.

mkelandis commented Feb 12, 2018

+1... blocker for windows. would appreciate any information on workarounds.

@los93sol

This comment has been minimized.

Show comment
Hide comment
@los93sol

los93sol Feb 12, 2018

Agreed, the only workaround I found was to install a Linux VM and run docker from there, this defeating the purpose. I should not my setup is server 1709 which requires docker-ee so a little different than the typical docker for Windows, but my testing with D4W showed the same results

los93sol commented Feb 12, 2018

Agreed, the only workaround I found was to install a Linux VM and run docker from there, this defeating the purpose. I should not my setup is server 1709 which requires docker-ee so a little different than the typical docker for Windows, but my testing with D4W showed the same results

@naeem

This comment has been minimized.

Show comment
Hide comment
@naeem

naeem Feb 21, 2018

Any update on this blocker?

naeem commented Feb 21, 2018

Any update on this blocker?

@hetykai

This comment has been minimized.

Show comment
Hide comment
@hetykai

hetykai Mar 9, 2018

same here

hetykai commented Mar 9, 2018

same here

@ignaciosolergarcia

This comment has been minimized.

Show comment
Hide comment
@ignaciosolergarcia

ignaciosolergarcia Mar 9, 2018

One more to add to the list of blocked users :\

ignaciosolergarcia commented Mar 9, 2018

One more to add to the list of blocked users :\

@rn

This comment has been minimized.

Show comment
Hide comment
@rn

rn Mar 9, 2018

Contributor

I'm sorry, but closing this as "won't fix" at least not on SMB/CIFS. LCOW currently also does not support chown but may in the future...it's under active development.

Contributor

rn commented Mar 9, 2018

I'm sorry, but closing this as "won't fix" at least not on SMB/CIFS. LCOW currently also does not support chown but may in the future...it's under active development.

@rn rn closed this Mar 9, 2018

@rn rn added the status/0-wont-fix label Mar 9, 2018

@andrey-skat

This comment has been minimized.

Show comment
Hide comment
@andrey-skat

andrey-skat Mar 10, 2018

How to workaround this issue? Can WSL help with this?

andrey-skat commented Mar 10, 2018

How to workaround this issue? Can WSL help with this?

@rn

This comment has been minimized.

Show comment
Hide comment
@rn

rn Mar 10, 2018

Contributor

Currently there is no workaround. As said in the future LCOW (Linux Containers on Windows) may support chown but I have no idea about the timeframe (this is developed by Microsoft)

Contributor

rn commented Mar 10, 2018

Currently there is no workaround. As said in the future LCOW (Linux Containers on Windows) may support chown but I have no idea about the timeframe (this is developed by Microsoft)

@victorelec14

This comment has been minimized.

Show comment
Hide comment

victorelec14 commented Mar 23, 2018

@pldmgg

This comment has been minimized.

Show comment
Hide comment
@pldmgg

pldmgg Apr 7, 2018

@friism @rn Just throwing this out there, and I haven't really thought this through, but wouldn't a relatively easy fix for this be simply to change docker volume create functionality to create an ext4 formatted .vhdx and mount it into the MobyLinuxVM at /var/lib/docker/volumes/<volumename>/_data? I think the same idea would probably work for Windows Container mode running Linux containers (i.e. create ext4 formatted the .vhdx under $env:ProgramData\Docker\volumes\<volumename>\_data and have the linux container mount it)

pldmgg commented Apr 7, 2018

@friism @rn Just throwing this out there, and I haven't really thought this through, but wouldn't a relatively easy fix for this be simply to change docker volume create functionality to create an ext4 formatted .vhdx and mount it into the MobyLinuxVM at /var/lib/docker/volumes/<volumename>/_data? I think the same idea would probably work for Windows Container mode running Linux containers (i.e. create ext4 formatted the .vhdx under $env:ProgramData\Docker\volumes\<volumename>\_data and have the linux container mount it)

@RobertPepkaSEL

This comment has been minimized.

Show comment
Hide comment
@RobertPepkaSEL

RobertPepkaSEL Apr 19, 2018

Currently, a workaround for this is to use named volumes. It's not exactly the same, but gets the job done:

https://forums.docker.com/t/data-directory-var-lib-postgresql-data-pgdata-has-wrong-ownership/17963/25

(The link above is courtesy of this SO question: https://stackoverflow.com/questions/43504238/postgresql-docker-container-on-widnows )

RobertPepkaSEL commented Apr 19, 2018

Currently, a workaround for this is to use named volumes. It's not exactly the same, but gets the job done:

https://forums.docker.com/t/data-directory-var-lib-postgresql-data-pgdata-has-wrong-ownership/17963/25

(The link above is courtesy of this SO question: https://stackoverflow.com/questions/43504238/postgresql-docker-container-on-widnows )

@elijan

This comment has been minimized.

Show comment
Hide comment
@elijan

elijan Jul 5, 2018

+1

Haven't jump the ship to docker for ages now because there are constantly issues with docker-for-win. finally decided to set up containers for my app and now this...

Sticking to vagrant I guess until somone chmods the folder

elijan commented Jul 5, 2018

+1

Haven't jump the ship to docker for ages now because there are constantly issues with docker-for-win. finally decided to set up containers for my app and now this...

Sticking to vagrant I guess until somone chmods the folder

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment