进入一个正在运行的容器命令:
[root@localhost ~]# docker ps ###列出正在运行的容器 CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 3212ddd69f38 ubuntu:16.04 "/bin/bash" 35 minutes ago Up 35 minutes agitated_ptolemy 43c1c07316af training/webapp "python app.py" 39 minutes ago Up 39 minutes 0.0.0.0:5000->5000/tcp admiring_mestorf [root@localhost ~]# docker exec -it 3212ddd69f38 /bin/bash ###进入这个id的容器
删除一个镜像:
[root@localhost ~]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE docker.io/nginx latest f68d6e55e065 3 days ago 109 MB docker.io/ubuntu 16.04 13c9f1285025 2 weeks ago 119 MB docker.io/httpd latest e77c77f17b46 3 weeks ago 140 MB docker.io/centos/httpd latest 2cc07fbb5000 6 months ago 258 MB docker.io/ubuntu 15.10 9b9cb95443b5 2 years ago 137 MB docker.io/training/webapp latest 6fae60ef3446 4 years ago 349 MB [root@localhost ~]# docker rmi -f 9b9cb95443b5 ##删除指定id的镜像 Untagged: docker.io/ubuntu:15.10 Untagged: docker.io/ubuntu@sha256:02521a2d079595241c6793b2044f02eecf294034f31d6e235ac4b2b54ffc41f3 Deleted: sha256:9b9cb95443b5f846cd3c8cfa3f64e63b6ba68de2618a08875a119c81a8f96698 [root@localhost ~]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE docker.io/nginx latest f68d6e55e065 3 days ago 109 MB docker.io/ubuntu 16.04 13c9f1285025 2 weeks ago 119 MB docker.io/httpd latest e77c77f17b46 3 weeks ago 140 MB docker.io/centos/httpd latest 2cc07fbb5000 6 months ago 258 MB docker.io/training/webapp latest 6fae60ef3446 4 years ago 349 MB [root@localhost ~]#