Skip to content

Adjust "/var/run/postgresql" permissions for arbitrary-user support - #289

Merged
yosifkit merged 1 commit into
docker-library:masterfrom
infosiftr:var-run-postgresql
May 19, 2017
Merged

Adjust "/var/run/postgresql" permissions for arbitrary-user support#289
yosifkit merged 1 commit into
docker-library:masterfrom
infosiftr:var-run-postgresql

Conversation

@tianon

Copy link
Copy Markdown
Member

Fixes#264

Before:

$ rm -rf ~/wtf && mkdir -p ~/wtf && docker run -it --rm --name test --user "$(id -u):$(id -g)" -v /etc/passwd:/etc/passwd:ro -v "$HOME/wtf":/var/lib/postgresql/data postgres:9.6The files belonging to this database system will be owned by user "tianon".This user must also own the server process.The database cluster will be initialized with locale "en_US.utf8".The default database encoding has accordingly been set to "UTF8".The default text search configuration will be set to "english".Data page checksums are disabled.fixing permissions on existing directory /var/lib/postgresql/data ... okcreating subdirectories ... okselecting default max_connections ... 100selecting default shared_buffers ... 128MBselecting dynamic shared memory implementation ... posixcreating configuration files ... okrunning bootstrap script ... okperforming post-bootstrap initialization ... oksyncing data to disk ... okWARNING: enabling "trust" authentication for local connectionsYou can change this by editing pg_hba.conf or using the option -A, or--auth-local and --auth-host, the next time you run initdb.Success. You can now start the database server using: pg_ctl -D /var/lib/postgresql/data -l logfile start****************************************************WARNING: No password has been set for the database. This will allow anyone with access to the Postgres port to access your database. In Docker's default configuration, this is effectively any other container on the same system. Use "-e POSTGRES_PASSWORD=password" to set it in "docker run".****************************************************waiting for server to start....LOG: could not bind IPv6 socket: Cannot assign requested addressHINT: Is another postmaster already running on port 5432? If not, wait a few seconds and retry.FATAL: could not create lock file "/var/run/postgresql/.s.PGSQL.5432.lock": Permission deniedLOG: database system is shut down stopped waitingpg_ctl: could not start serverExamine the log output.

After:

$ rm -rf ~/wtf && mkdir -p ~/wtf && docker run -it --rm --name test --user "$(id -u):$(id -g)" -v /etc/passwd:/etc/passwd:ro -v "$HOME/wtf":/var/lib/postgresql/data edee229acce4The files belonging to this database system will be owned by user "tianon".This user must also own the server process.The database cluster will be initialized with locale "en_US.utf8".The default database encoding has accordingly been set to "UTF8".The default text search configuration will be set to "english".Data page checksums are disabled.fixing permissions on existing directory /var/lib/postgresql/data ... okcreating subdirectories ... okselecting default max_connections ... 100selecting default shared_buffers ... 128MBselecting dynamic shared memory implementation ... posixcreating configuration files ... okrunning bootstrap script ... okperforming post-bootstrap initialization ... oksyncing data to disk ... okWARNING: enabling "trust" authentication for local connectionsYou can change this by editing pg_hba.conf or using the option -A, or--auth-local and --auth-host, the next time you run initdb.Success. You can now start the database server using: pg_ctl -D /var/lib/postgresql/data -l logfile start****************************************************WARNING: No password has been set for the database. This will allow anyone with access to the Postgres port to access your database. In Docker's default configuration, this is effectively any other container on the same system. Use "-e POSTGRES_PASSWORD=password" to set it in "docker run".****************************************************waiting for server to start....LOG: could not bind IPv6 socket: Cannot assign requested addressHINT: Is another postmaster already running on port 5432? If not, wait a few seconds and retry.LOG: database system was shut down at 2017-05-19 17:48:43 UTCLOG: MultiXact member wraparound protections are now enabledLOG: autovacuum launcher startedLOG: database system is ready to accept connections doneserver startedALTER ROLE/usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint-initdb.d/*LOG: received fast shutdown requestLOG: aborting any active transactionsLOG: autovacuum launcher shutting downwaiting for server to shut down....LOG: shutting downLOG: database system is shut down doneserver stoppedPostgreSQL init process complete; ready for start up.LOG: database system was shut down at 2017-05-19 17:48:45 UTCLOG: MultiXact member wraparound protections are now enabledLOG: autovacuum launcher startedLOG: database system is ready to accept connections

@yosifkit
yosifkit merged commit 6d58978 into docker-library:masterMay 19, 2017
@yosifkit
yosifkit deleted the var-run-postgresql branch May 19, 2017 20:17
tianon added a commit to infosiftr/stackbrew that referenced this pull request May 19, 2017
- `openjdk`: `debian 7u131-2.6.9-2~deb8u1`, `debian 9~b170-2`
- `postgres`: adjust `/var/run/postgresql` permissions for any-user (docker-library/postgres#289)
- `ruby`: bundler 1.15.0
@tianon

This comment was marked as off-topic.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Running as non-default user results in permission error on lock file

2 participants

@tianon@yosifkit