1、安装pip,需要epel源的支持
[root@localhost ~]# yum install epel-release
[root@localhost ~]# yum install -y python-pip
2、安装runlike
[root@localhost ~]# pip install runlike
3、启动一个容器
[root@localhost ~]# docker run -itd -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=123456 -p 54320:5432 -v /data/db/postgres:/var/lib/postgresql/data --restart=always --detach=true --name postgres_ver_1013 postgres:10.13 postgres
4、使用runlike命令查看docker run
启动参数,命令格式:runlike -p <容器名>|<容器ID>
[root@localhost ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
4858b0320e69 postgres:10.13 "docker-entrypoint.s…" 4 minutes ago Up 4 minutes 0.0.0.0:54320->5432/tcp postgres_ver_1013
[root@localhost ~]# runlike -p postgres_ver_1013
docker run \
--name=postgres_ver_1013 \
--hostname=4858b0320e69 \
--env=POSTGRES_USER=postgres \
--env=POSTGRES_PASSWORD=123456 \
--env=PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/lib/postgresql/10/bin \
--env=GOSU_VERSION=1.12 \
--env=LANG=en_US.utf8 \
--env=PG_MAJOR=10 \
--env=PG_VERSION=10.13-1.pgdg90+1 \
--env=PGDATA=/var/lib/postgresql/data \
--volume=/data/db/postgres:/var/lib/postgresql/data \
--volume=/var/lib/postgresql/data \
-p 54320:5432 \
--restart=always \
--detach=true \
-t \
postgres:10.13 \
postgres