Skip to content

Gosu not working #269

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
icougil opened this issue Mar 22, 2017 · 2 comments
Closed

Gosu not working #269

icougil opened this issue Mar 22, 2017 · 2 comments

Comments

@icougil
Copy link

icougil commented Mar 22, 2017

Hi.

We are using the official postgres docker image in our CI system and we've found that gosu is not working since the last changes (because we haven't change anything from our part).

What we do is just build our docker image based on the latest version of the official docker image for Postgres just adding few SQL scripts inside /docker-entrypoint-initdb.d. What we have found is that our image is build correctly but the image never cames up because it returns an error. This is exactly what we can see after trying to starting the container:

...
waiting for server to start....LOG:  database system was shut down at 2017-03-22 15:06:56 UTC
LOG:  MultiXact member wraparound protections are now enabled
LOG:  database system is ready to accept connections
LOG:  autovacuum launcher started
 done
server started
ALTER ROLE


/usr/local/bin/docker-entrypoint.sh: running /docker-entrypoint-initdb.d/01-init-db.sh
error: failed switching to "postgres": operation not permitted

Here you can see part of the Dockerfile we are using:

FROM postgres:latest

ENV DB_USER xxx
ENV DB_PASSWORD xxx
ENV DB_NAME xxx
ENV DB_ENCODING UTF-8

ADD init/*.sh /docker-entrypoint-initdb.d/
RUN chmod +x /docker-entrypoint-initdb.d/*.sh

And in this case this is the shell script (01-init-db.sh) that we would like to run that is stored in our `/init' folder:

#!/bin/bash

{ gosu postgres psql --user postgres <<-EOSQL
    CREATE USER "$DB_USER" WITH PASSWORD '$DB_PASSWORD';
    CREATE DATABASE "$DB_NAME" WITH OWNER="$DB_USER" TEMPLATE=template0 ENCODING='$DB_ENCODING';
EOSQL
}

We have found recently some changes on the docker-entrypoint.sh, could be possible that those changes made gosu not work?

Best,

@tianon
Copy link
Member

tianon commented Mar 22, 2017

Looks like this is due to #253 -- can you try dropping the use of gosu postgres from your script and see if that fixes the issue?

@icougil
Copy link
Author

icougil commented Mar 23, 2017

Yes, it solved the problem! Thx! ;-)

@icougil icougil closed this as completed Mar 23, 2017
Dagefoerde added a commit to learnweb/moodledocker that referenced this issue Apr 14, 2017
was related to changes in official postgres image, cf. docker-library/postgres#269
pgracio added a commit to pgracio/dhis2-docker that referenced this issue May 3, 2017
Gimly added a commit to Gimly/docker-postgres-replication that referenced this issue Jul 17, 2017
Something has changed in recent versions of the postgres image that
breaks the use of gosu (or rather, makes it useless). See
docker-library/postgres#269. It created an
error when the script was creating a slave instnace (see issue nebirhos#4).

Also updated the Dockerfile to use the 9.6 version of the Docker image.
etheleon added a commit to etheleon/mimic-code that referenced this issue Aug 13, 2017
the new postgres docker image has issues with gosu postgres. the suggested solution is to remove this 
docker-library/postgres#269
etheleon added a commit to etheleon/mimic-code that referenced this issue Aug 14, 2017
New Postgres docker image has issues with the command `gosu postgres cmd`.  For example `gosu postgres pg_ctl stop`

The suggested solution is to remove it. 
docker-library/postgres#269
pgiraud added a commit to dalibo/docker that referenced this issue Jun 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants