1. 程式人生 > >Ubuntu docker Postgresql

Ubuntu docker Postgresql

sin status pass ima com dig not esql container

prereq:

docker is ready and on.

chen@Chen-System:~$ docker pull postgres
Using default tag: latest
latest: Pulling from library/postgres
f17d81b4b692: Pull complete 
c1f213be5edb: Pull complete 
9c79723dc510: Pull complete 
603a66804109: Pull complete 
b4f1b901e523: Pull complete 
99d9650419de: Pull complete 
02d87bb25bad: Pull complete 
333a24caa91e: Pull complete 
2ace4c87570a: Pull complete 
3add70ce5596: Pull complete 
947f7d36d500: Pull complete 
5e194c53f09f: Pull complete 
e0d520465b2d: Pull complete 
97f206959126: Pull complete 
Digest: sha256:76ff79d72ef95b7c136037c0e8ab629914a8d5e430a3a2aef7d959b5da9a33c5
Status: Downloaded newer image 
for postgres:latest chen@Chen-System:~$ docker run --name mypostgres -p 54321:5432 -e POSTGRES_PASSWORD=<pwd> -d postgres b3d66c56276c1d0f77074b301b01ce89dd4eb6ceb5f8e5d38d034a1fc5ffc556 chen@Chen-System:~$ docker container ls CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES b3d66c56276c postgres
"docker-entrypoint.s…" 38 seconds ago Up 38 seconds 0.0.0.0:54321->5432/tcp mypostgres


chen@Chen-System:~$ psql -U postgres -h localhost -p 54321
Password for user postgres:
psql (10.5 (Ubuntu 10.5-0ubuntu0.18.04), server 11.0 (Debian 11.0-1.pgdg90+2))
WARNING: psql major version 10, server major version 11.
Some psql features might not work.
Type "help" for help.

postgres=#

Ubuntu docker Postgresql