分享工作和学习中的点点滴滴,包括前端、后端、运维、产品等各个方面,欢迎您来关注订阅!
分类: LINUX
2020-07-13 16:19:15
Docker是一个开源工具,它可以让创建和管理容器变得简单。容器就像是轻量级的虚拟机,作为一种新兴的虚拟化方式,Docker跟传统的虚拟化方式相比具有众多优势。 |
[root@localhost ~]# docker run -i -t centos /bin/bash [root@86a46aa13531 /]# ls bin dev etc home lib lib64 lost+found media mnt opt proc root run sbin srv sys tmp usr var [root@86a46aa13531 /]#
-a 作者信息,-m 提交信息,-p 提交时暂停容器运行,如果提交成功会返回一个id数字串。
[root@localhost ~]# docker commit -m "aaa" -a "chao" 86a46aa13531 sha256:6efd478542f1a99b20796c9372c2976b87344263a051dbf39fd385ea4dbb8873
[root@localhost ~]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE chao latest 7b6e3368140a 47 hours ago 237 MB 6efd478542f1 47 hours ago 237 MB docker.io/centos latest 470671670cac 6 weeks ago 237 MB
docker save 转出,docker load 转入。
[root@localhost ~]# docker save -o CHAO.tar chao:latest [root@localhost ~]# ls 123 anaconda-ks.cfg CHAO.tar initial-setup-ks.cfg
[root@localhost ~]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE chao latest 7b6e3368140a 47 hours ago 237 MB 6efd478542f1 47 hours ago 237 MB docker.io/centos latest 470671670cac 6 weeks ago 237 MB [root@localhost ~]# docker rmi -f 7b6e3368140a Untagged: chao:latest Deleted: sha256:7b6e3368140ac0e977bc37110f267e3c7b641e0b42ba04e93b1bbda46331c29c [root@localhost ~]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE 6efd478542f1 47 hours ago 237 MB docker.io/centos latest 470671670cac 6 weeks ago 237 MB
[root@localhost ~]# docker load < chao.tar Loaded image: chao:latest [root@localhost ~]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE chao latest 7b6e3368140a 47 hours ago 237 MB 6efd478542f1 47 hours ago 237 MB docker.io/centos latest 470671670cac 6 weeks ago 237 MB
以上就是docker的基础操作