Comments (6)
Another variant to the recommended version of @yosifkit
sudo docker run --name pt -t -p 0.0.0.0:5555:5432 -d postgres
to expose the container internal port 5432 to port 5555 on your host machine.
from postgres.
Could you attach the logs from your pgadmin
and postgres
containers? docker logs [id | name]
from postgres.
postgres logs:
2015-08-02 14:44:16 MSK LOG: database system was shut down at 2015-08-02 02:16:41 MSK
2015-08-02 14:44:16 MSK LOG: MultiXact member wraparound protections are now enabled
2015-08-02 14:44:16 MSK LOG: autovacuum launcher started
2015-08-02 14:44:16 MSK LOG: database system is ready to accept connections
2015-08-02 14:44:16 MSK LOG: incomplete startup packet
pgadmin:
2015-08-02 14:46:47 STATUS : Соединение с базой данных...
2015-08-02 14:46:47 INFO : Opening connection with connection string: host='localhost' dbname='postgres' user='postgres' password='XXXXXX' port=5432 application_name='pgAdmin III - Браузер'
2015-08-02 14:46:49 STATUS : Соединение с базой данных... (2,02 секунд)
2015-08-02 14:46:49 ERROR : Error connecting to the server: server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
docker logs:
ivan@ivan-VirtualBox:/var/log/postgresql$ docker logs pg
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
creating template1 database in /var/lib/postgresql/data/base/1 ... ok
initializing pg_authid ... ok
initializing dependencies ... ok
creating system views ... ok
loading system objects' descriptions ... ok
creating collations ... ok
creating conversions ... ok
creating dictionaries ... ok
setting privileges on built-in objects ... ok
creating information schema ... ok
loading PL/pgSQL server-side language ... ok
vacuuming database template1 ... ok
copying template1 to template0 ... ok
copying template1 to postgres ... ok
syncing data to disk ... 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.
Success. You can now start the database server using:
postgres -D /var/lib/postgresql/data
or
pg_ctl -D /var/lib/postgresql/data -l logfile start
FATAL: the database system is starting up
LOG: database system was shut down at 2015-08-02 11:45:57 UTC
PostgreSQL init process in progress...
LOG: MultiXact member wraparound protections are now enabled
LOG: database system is ready to accept connections
LOG: autovacuum launcher started
ALTER ROLE
/docker-entrypoint.sh: ignoring /docker-entrypoint-initdb.d/*
LOG: received smart shutdown request
LOG: autovacuum launcher shutting down
LOG: shutting down
LOG: database system is shut down
PostgreSQL init process complete; ready for start up.
LOG: database system was shut down at 2015-08-02 11:45:59 UTC
LOG: MultiXact member wraparound protections are now enabled
LOG: database system is ready to accept connections
LOG: autovacuum launcher started
from postgres.
It looks like your pgadmin
is trying to connect to localhost
, if that is being run in a container you will need to tell it to connect to the IP address of the postgres container. Here is how I connect with psql
in a separate container:
docker run -it --rm --link some-postgres:postgres postgres psql -h postgres -U postgres
# can use the host "postgres" since container links will populate /etc/hosts
What are the docker run lines that you are doing?
from postgres.
renzok, your advice is helped. i did change port to 5555 and pgadmin start connect to database. thank you!
from postgres.
good to hear :) I guess then that this issue is then good to be closed.
from postgres.
Related Issues (20)
- Skip postgres restart on first run HOT 1
- Reproducible SIGSEGV in query HOT 1
- Separating config using PGDATA does not seem to behave as described in the docs HOT 12
- Upgrade older images to OCI Format or Docker Image manifest v2, schema 2 HOT 3
- Add a HEALTHCHECK to the images HOT 7
- include_dirs env var HOT 4
- Add "build from github.com/postgres/postgres" variation HOT 2
- PostgreSQL 17beta1 HOT 3
- CVE-2023-24538 CVE-2023-24540 HOT 2
- Use of GOSU introduces critical CVEs HOT 2
- PostgreSQL error ( log Docker) HOT 1
- Issue of working with pgsql in my vps machine with easypanel
- Nurlanhajizada
- Please help, I have persisted it, but the table and data are not restored after restarting the container. HOT 1
- please add a Container shell access and viewing MySQL logs directly HOT 3
- associate --user id with the internal postgres user id HOT 13
- Kill a postgres container immediately HOT 5
- Remove gosu HOT 3
- Log syslog to Docker logs command
- Security issues in latest postgres image HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from postgres.