postgresql

image

start a postgres instance

docker run --name some-postgres -e POSTGRES_PASSWORD=mysecretpassword -d postgres

connect to it from an application

docker run --name some-app --link some-postgres:postgres -d application-that-uses-postgres
docker run -it --rm --link some-postgres:postgres postgres psql -h postgres -U postgres
psql
docker run --name postgresql -v pgdata:/var/lib/postgresql/data -e POSTGRES_PASSWORD=123456 -d -p 5432:5432 postgres
posted @ 2017-04-28 10:29  白云辉  阅读(170)  评论(0编辑  收藏  举报