移除镜像
docker rmi 【镜像ID】
移除容器
docker rm 【容器ID】
docker进入当前正在运行的容器
docker exec -it 容器id /bin/bash
启动容器
1.以下命令使用 redis 镜像启动一个容器,参数为以命令行模式进入该容器:
[root@localhost /]# docker run -it redis bash
root@17f39d58a042:/data# exit
exit
2.用start命令启动一个已经停止的容器:
[root@localhost /]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
17f39d58a042 redis "docker-entrypoint.s…" 15 seconds ago Exited (0) 8 seconds ago elated_vaughan
da34653a5be1 ubuntu "/bin/bash" 38 minutes ago Up 29 minutes elated_pascal
6a03290cbf61 centos "/bin/bash" 4 hours ago Up 4 hours centos-test
[root@localhost /]# docker start 17
3.用exec命令进入正在运行的容器,使其在exit后依旧运行:
[root@localhost /]# docker exec -it 17 bash
root@17f39d58a042:/data# exit
exit
给镜像打tag
docker tag 【REPOSITORY】:【旧tag】 【新REPOSITORY】:【新tag】
tag作用: