Skip to content

Postgres Container doesn't run #592

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
MohammedTawfik opened this issue Jun 21, 2019 · 3 comments
Closed

Postgres Container doesn't run #592

MohammedTawfik opened this issue Jun 21, 2019 · 3 comments
Labels
question Usability question, not directly related to an error with the image

Comments

@MohammedTawfik
Copy link

i used this command to create postgres container
docker run -d -p 5432:5432 --name posgres1 postgres -v postgres-data:/var/lib/postgresql/data

but when try to connect to the container the container stopped and When run docker logs i got this logs

The files belonging to this database system will be owned by user "postgres".
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 ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting dynamic shared memory implementation ... posix
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok

WARNING: enabling "trust" authentication for local connections
You 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.
syncing data to disk ... ok

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....2019-06-21 19:06:12.680 UTC [48] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2019-06-21 19:06:12.783 UTC [48] LOG: could not resolve "localhost": Name or service not known
2019-06-21 19:06:12.783 UTC [48] LOG: disabling statistics collector for lack of working socket
2019-06-21 19:06:12.783 UTC [48] WARNING: autovacuum not started because of misconfiguration
2019-06-21 19:06:12.783 UTC [48] HINT: Enable the "track_counts" option.
2019-06-21 19:06:12.794 UTC [49] LOG: database system was shut down at 2019-06-21 19:06:08 UTC
2019-06-21 19:06:12.826 UTC [48] LOG: database system is ready to accept connections
done
server started

/usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint-initdb.d/*

2019-06-21 19:06:12.862 UTC [48] LOG: received fast shutdown request
waiting for server to shut down....2019-06-21 19:06:12.866 UTC [48] LOG: aborting any active transactions
2019-06-21 19:06:12.868 UTC [48] LOG: background worker "logical replication launcher" (PID 53) exited with exit code 1
2019-06-21 19:06:12.869 UTC [50] LOG: shutting down
2019-06-21 19:06:12.917 UTC [48] LOG: database system is shut down
done
server stopped

PostgreSQL init process complete; ready for start up.

postgres: invalid option -- 'v'
Try "postgres --help" for more information.

@wglambert wglambert added the question Usability question, not directly related to an error with the image label Jun 21, 2019
@wglambert
Copy link

docker run -d -p 5432:5432 --name posgres1 postgres -v postgres-data:/var/lib/postgresql/data

Your syntax is off; the -v option to docker run is after the image, so the command is treating that as an argument for the image

$ docker run
"docker run" requires at least 1 argument.
See 'docker run --help'.

Usage:  docker run [OPTIONS] IMAGE [COMMAND] [ARG...]

So move any options to docker run before you give it the image:
docker run -d -p 5432:5432 --name posgres1 -v postgres-data:/var/lib/postgresql/data postgres

@MohammedTawfik
Copy link
Author

It is working thanks alot @wglambert

@bharath17reddy

This comment was marked as off-topic.

@docker-library docker-library locked as resolved and limited conversation to collaborators May 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
question Usability question, not directly related to an error with the image
Projects
None yet
Development

No branches or pull requests

3 participants