合 Docker之容器启动命令查看工具runlike
简介
runlike 是查看 docker 容器启动命令的工具。
安装
1 | pip3 install runlike |
示例
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | [root@mdw ~]# docker ps -a --format "table {{.ID}} {{.Names}}\t{{.Image}}" CONTAINER ID NAMES IMAGE a03d68768b33 lhrpowa lhrbest/lhrpowa:1.0 ff24f887858d lhrmssql2022 lhrbest/mssql2022:2.0 369c51304911 lhrmssql2019 lhrbest/mssql2019:2.0 f9515d8c4756 lhrmssql2017 lhrbest/mssql2017:2.0 9feaa1008aa0 ora11204 lhrbest/oracle_11g_ee_lhr_11.2.0.4:2.0 052400cdd58e ora19c lhrbest/oracle19clhr_rpm_db_12.2.0.3:2.0 26e233182f13 redisinsight oblakstudio/redisinsight:latest 99c3d6648eab gpdb7 lhrbest/greenplum:7.0.0_v2 db294830a440 lhr-pmm-server percona/pmm-server:2.40.1-el7 e53beae6b9c8 lhrharbor lhrbest/harbor:1.0 e664cb6eede1 kmdw lhrbest/lhrcentos76:9.2 [root@mdw ~]# [root@mdw ~]# runlike -p ff24f887858d docker run --name=lhrmssql2022 \ --hostname=lhrmssql2022 \ --mac-address=02:42:c0:5c:00:09 \ --volume=/sys/fs/cgroup:/sys/fs/cgroup \ --privileged \ -p 14322:1433 \ -p 222:22 \ --expose=3389 \ --restart=always \ --runtime=runc \ --detach=true \ lhrbest/mssql2022:2.0 \ /usr/sbin/init [root@mdw ~]# [root@mdw ~]# [root@mdw ~]# [root@mdw ~]# runlike -p db294830a440 docker run --name=lhr-pmm-server \ --hostname=lhr-pmm-server \ --mac-address=02:42:c0:5c:00:0a \ --volume=lhr-pmm-data:/srv \ --workdir=/opt \ -p 2443:443 \ --expose=80 \ --restart=always \ --runtime=runc \ --detach=true \ percona/pmm-server:2.40.1-el7 \ /opt/entrypoint.sh [root@mdw ~]# |
如果需要查询所有容器的执行命令,可以用 xargs 批量执行: