Closed
Description
I'm trying to execute a simple script, but it seems I don't have enough permissions with postgres user, specially to create folders. Shouldn't the entrypoint script be executed as root? So it can be possible to do anything with my scripts?
The idea around this is to automatically add .sql files to the init folder, but I don't want to edit the Dockerfile and place a COPY each time I have a new sql file to execute.
This is a simple example to illustrate the problem, the real init.sh is supposed to copy files from a Volume to the right folder, but the copy doesn't have enough permissions, just like the mkdir in the example bellow:
Dockerfile
FROM postgres:9.5
....
COPY ./init.sh /docker-entrypoint-initdb.d/
RUN chmod +x /docker-entrypoint-initdb.d/init.sh
init.sh
#!/bin/bash
whoami
mkdir /somefolder
Result
/usr/local/bin/docker-entrypoint.sh: running /docker-entrypoint-initdb.d/init.sh
postgres
mkdir: cannot create directory ‘/somefolder’: Permission denied
Metadata
Metadata
Assignees
Labels
No labels