Code Monkey home page Code Monkey logo

Comments (7)

praiskup avatar praiskup commented on August 23, 2024 2

Checked again -- atm. PostgreSQL processes are run as 'postgres:postgres', you you somehow have to set the permissions so the process can write to data directory. Other option is to change the user by docker run -u and set the directory ownership accordignly. Btw., soon we could (in #208) add the 'postgres' user into 'root' group...

from postgresql-container.

praiskup avatar praiskup commented on August 23, 2024

[root@client ~]# setfacl -m u:26:-wx /srv/db2/cccp/

The benefit of setfacl is primarily that you don't have to be root to allow containerized app to write there. The drawback is that it doesn't work for everybody, hm. Do you have spelling ideas for the documentation?

Note: Changing NFS server config to have uid=26 works for postgresql container, however, how does one manage UID/GID consistency all over the place then?

All over the place == all containers? You can make the directory world-writeable, or group '0' writeable (I think by default the processes are run under group 0). I'm not convinced this is a good recommendable default, though.

from postgresql-container.

navidshaikh avatar navidshaikh commented on August 23, 2024

Do you have spelling ideas for the documentation?

as in if documentation can be updated with a better explanation?

from postgresql-container.

navidshaikh avatar navidshaikh commented on August 23, 2024

I'm not convinced this is a good recommendable default, though.

@praiskup
Yes, any idea what could be a better solution if one wants to have NFS share mounted as data directory for postgresql?

from postgresql-container.

navidshaikh avatar navidshaikh commented on August 23, 2024

soon we could (in #208) add the 'postgres' user into 'root' group...

@praiskup : I have been keeping an eye on PR #208. IIUC the outcome should be seamlessly attaching host machine volume to /var/lib/pgsql/data directory inside the container. However, it seems to fail with permission issues again. Am I missing something here?

# docker images registry.centos.org/centos/postgresql-95-centos7
REPOSITORY                                         TAG                 IMAGE ID            CREATED             SIZE
registry.centos.org/centos/postgresql-95-centos7   latest              0785e3c7337e        About an hour ago   335 MB

# mkdir /tmp/foo

# docker run -d --name=vol-test -e POSTGRESQL_USER=cccp -e POSTGRESQL_PASSWORD=cccp -e POSTGRESQL_DATABASE=cccp -v /tmp/foo:/var/lib/pgsql/data:Z registry.centos.org/centos/postgresql-95-centos7

# docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES

# docker logs -f vol-test
mkdir: cannot create directory '/var/lib/pgsql/data/userdata': Permission denied

# cat /etc/centos-release
CentOS Linux release 7.4.1708 (Core) 

# rpm -q docker
docker-1.12.6-61.git85d7426.el7.centos.x86_64

Results are same with and without providing :Z options to volume option in docker run command.

from postgresql-container.

praiskup avatar praiskup commented on August 23, 2024

@navidshaikh have you added proper group ownership to /tmp/foo? (sudo chgrp root /tmp/foo)

from postgresql-container.

navidshaikh avatar navidshaikh commented on August 23, 2024

have you added proper group ownership to /tmp/foo? (sudo chgrp root /tmp/foo)

@praiskup

# ls -la /tmp/foo/
total 0
drwxr-xr-x.  2 root root   6 Jan 10 15:08 .
drwxrwxrwt. 12 root root 250 Jan 11 03:25 ..

from postgresql-container.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.