1.docker ps -a查看运行的镜像进程

[root@mylinux~]# docker ps -a
CONTAINER ID        IMAGE                       COMMAND                  CREATED             STATUS              PORTS                               NAMES
98acb9dcb2a2        redis:5                     "docker-entrypoint.s…"   8 minutes ago       Up 8 minutes        0.0.0.0:6379->6379/tcp              redis
1b1ff7f08583        mysql:5.7                   "docker-entrypoint.s…"   8 minutes ago       Up 8 minutes        0.0.0.0:3306->3306/tcp, 33060/tcp   mysql
035129f60a64        mongo:3.6                   "docker-entrypoint.s…"   8 minutes ago       Up 8 minutes        0.0.0.0:27017->27017/tcp            mongo

2.docker stop CONTAINER ID例如要删除mysql镜像,停止该镜像进程

docker stop 035129f60a64

3.docker rm CONTAINER ID卸载镜像

docker rm 035129f60a64

4.docker images 查看当前docker的镜像IMAGE ID

[root@mylinux ~]# docker images
REPOSITORY                  TAG                 IMAGE ID            CREATED             SIZE
redis                       5                   a4fe14ff1981        25 hours ago        95MB
mysql                       5.7                 7faa3c53e6d6        29 hours ago        373MB
mongo                       3.6                 0f29e46dab41        2 days ago          432MB

5.docker rmi IMAGE ID 删除镜像

[root@mylinux ~]# docker rmi 7faa3c53e6d6
Untagged: mysql:5.7
Untagged: mysql@sha256:204f5c77fe589c202e2ebc8b6b7dcdc442d67c07168916a302ede26b3e9ab168
Deleted: sha256:7faa3c53e6d699fe92d49a361e427c3af937c6cea9517f092e8013b1fff1c4d9
Deleted: sha256:bada5edfe9c6f4637d3ef1f4797561867be56282a750c0f1d4a83c227bc7a153
Deleted: sha256:cb6436acc7f930ab22d387016b2296e6c191fc4ebbb1611f84e3e15073588fc7
Deleted: sha256:1716d22cd68158fa78c60cf78d8e25457fb384de45de7775abf3a31502b6f00e
Deleted: sha256:daeb1195813697ab0182eb75de7f5a0f5bbfc4f8eb91be9f844777841e759984
Deleted: sha256:64ffa0ccfe7f5ecb4fb721913499a8e0b1af9897b69a0dbec0922f5b70666e76
Deleted: sha256:3b3af32bd87b74f389198eab8514d9f32f3e513dae313748b165333b286bd171
Deleted: sha256:c75ab456a585af40ca2ec8488164230deb81a1739d868604cb7b6661c24e37b5
Deleted: sha256:50a75eb6a0b2254fe5d96f999cc2087e72d515c93509a816bbd9ffb707a3b1b0
Deleted: sha256:1ae6616333a66450738a72a75c03bdf0236e0425ba0336ac5cdbe470ab6f4a3e
Deleted: sha256:68e318bd9263aedd19d9d73b051a262fa57e2a16f9c81c8b39163601020cd405
Deleted: sha256:6270adb5794c6987109e54af00ab456977c5d5cc6f1bc52c1ce58d32ec0f15f4
Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐