PostGIS Docker root Access

193 Views Asked by At

How to build postgis container as root user using docker-compose up?

In Dockerfile, separate attempts to set USER to root as well 0 did not work.

Updating docker-compose service with user: '0' was tried to no avail.

There error I am getting is Permission denied.

The id -u is always running as 999 during the build. This seems to be a system user with limited privilege.

I would prefer to just run docker-compose up with no flags and keep all configurations in docker-compose.yml and/or Dockerfile.

Dockerfile

FROM postgis/postgis:13-3.3
USER root
COPY ./startup.sh /docker-entrypoint-initdb.d/startup.sh

NOTE:

I realized that I should have added more context. I created another post that better describes the issue.

Open SSH tunnel during PostGIS Docker build

1

There are 1 best solutions below

1
On

Please be carefull with root, it can inject vulnerabilities in your database. I highly recommend to you to use it only for development.

You can run this command below:

docker-compose up --user root

Or put it in your docker-compose file:

services:
  postgis:
    user: root