3

So, basically, I have a docker container running and i have mounted a host file-system inside the container so that the processes inside can have access to its files. The running process inside the docker container requires the files in the mounted file-system to be its ownership but they have a different owner (my host user). Whenever i try to change the ownership from my host to that of the container, chown reports an invalid user error.

$ sudo chown -R odoo:odoo *
chown: invalid user: ‘odoo:odoo’

Is is possible to chown the files from the host using a non-existent user ? Or there's another way how to do things ?

By the way, the mounted folder contains additional modules that the process needs. I am developing those modules on my host machine and then testing them directly using docker without having to copy them again.

1 Answer 1

7

Use the UID number rather than a name. For example, if odoo has UID 1023 and GID 475 then you can use those numbers directly:

sudo chown -R 1023:475 *
2
  • 1
    Nice, thanks. Do you know why Linux doesn't accept usernames but accepts UIDs and GIDs ? Jun 23, 2018 at 17:21
  • 1
    It doesn't know about them - they're local to your Docker instance.
    – roaima
    Jun 23, 2018 at 20:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .