Docker安装与卸载(基本命令)
Dockers的安装搭建
参考:
https://www.cnblogs.com/jxxiaocao/p/12069139.html
采用apt源安装Docker的其他组件时,新组件与已安装的Docker容器最为匹配。
apt-get install docker docker-compose
service docker start 启动docker服务
docker images 查看当前镜像
docker run hello-world 运行这个镜像
dockers的卸载:
https://www.cnblogs.com/shmily3929/p/12085163.html
启动容器 systemctl satrt docker
关闭容器 systemctl stop docker
查看情况 docker ps
开启进程 docker-compose up -d
结束进程 docker-compose down
结束进程 docker-compose down
将镜像保存为本地tar文件 docker save imageid(镜像id)
> 保存的文件路径
使用load加载tar文件 docker load < 文件路径名字 (/root/ql.tar)
使用docker images查看容器镜像
检查刚刚load的镜像有没有加载进来,发现加载进来的镜像名称、标签均为none
使用docker tag tb4 demo:latest 修改镜像名称和标签名称,其中tb4为image id
使用docker run -dit demo:latest验证镜像是否能够成功run
docker删除镜像
- docker中删除images的命令为docker rmi 镜像id
docker images
┌──(root💀kali)-[/home/superwinner]
└─# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
aa523d4edb84 xiaomimi8/docker-awvs-14.7.220401065 "/bin/sh -c 'echo 12…" 2 weeks ago Exited (143) 40 hours ago my-awvs
┌──(root💀kali)-[/home/superwinner]
└─# docker rm aa523d4edb84 //删除CONTAINER ID
aa523d4edb84
┌──(root💀kali)-[/home/superwinner]
└─# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
xiaomimi8/docker-awvs-14.7.220401065 latest b94c1855ce6f 5 months ago 1.14GB
┌──(root💀kali)-[/home/superwinner]
└─# docker rmi b94c1855ce6f //删除镜像
Untagged: xiaomimi8/docker-awvs-14.7.220401065:latest
Untagged: xiaomimi8/docker-awvs-14.7.220401065@sha256:7f1aefd407ab5c9d4bdc9f7ee442e1c01e427ce8a841a9c1745015a32560fe9a
Deleted: sha256:b94c1855ce6fe91b140f77208b6a49fe1d0145ad1c5870314a848a43e64c4463
Deleted: sha256:47e53033a9204fe12d05b553417f716bcd077600f5349b2e8eaf10efebcc5030
Deleted: sha256:867d0767a47c392f80acb51572851923d6d3e55289828b0cd84a96ba342660c7
┌──(root💀kali)-[/home/superwinner]
└─# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE