1、Dockerfile
Library the FROM / Postgres MAINTAINER wenbin.ouyang # initialize PostgreSQL ENV POSTGRES_USER root ENV POSTGRES_PASSWORD root ENV POSTGRES_DB noah the ADD. /Noah_pgsql_init.sql /docker-entrypoint-initdb.d/ listening # runtime container port EXPOSE 5432
2, the mirror Construction
docker build -f ./Dockerfile -t oy/pgsql:1.0.0 .
docker images: View Mirror
3. Create a container
docker run -it -p 9001:5432 -v /var/lib/postgresql/oy_PostgreSQL_1.0.0_data:/var/lib/postgresql/data oy/pgsql:1.0.0
docker ps: check the running container
docker exec -it container id / bin / bash: into the container