From c341d0c2e5c5007b6f2a45b2873f54d7d03d458b Mon Sep 17 00:00:00 2001 From: Xavier-Do Date: Thu, 12 Sep 2024 15:05:19 +0200 Subject: [PATCH] wip --- DOCKER.md | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 DOCKER.md diff --git a/DOCKER.md b/DOCKER.md new file mode 100644 index 00000000..fee7cae5 --- /dev/null +++ b/DOCKER.md @@ -0,0 +1,40 @@ +The docker images generated on runbot can be downloaded but will have a user corresponding to the user of the runbot infrastructure + +This can be problematic when trying to connect to postgresql using peer authentication + + +Let say USER in the docker image is 10000 and name is odoo + +1 . If you have a local user with the same name and same id, nothing special to do + +2. If your user has a different id and name, here is a procedure to follow: + +- Create a user with the same uid and name as the one in the docker + sudo adduser --system --no-create-home odoo --uid 1337 + +- Grant access to the user to potgresql (this example give admin access, be carefull) + sudo -u postgres createuser -d -R -S odoo + + +3. If your user has the same name but different uid, here is a procedure to follow: + +- Create a user with the same uid but a different name, let say runbot + sudo adduser --system --no-create-home runbot --uid 10000 + +- Grant access to the user to potgresql (this example give admin access, be carefull) + sudo -u postgres createuser -d -R -S runbot + +- edit /etc/postgresql/14/main/pg_ident.conf and add this line + runbot runbot odoo + runbot odoo odoo + +- edit /etc/postgresql/14/main/pg_hba.conf and change this line + local all all peer +with this line + local all all peer map=runbot + + +Finally, add the volume when stating the docker + +docker run -ti --rm -v /var/run/postgresql:/var/run/postgresql +