本文共 1564 字,大约阅读时间需要 5 分钟。
1:通过tar 备份目录tar -cvpf /home/buildrpm.tar --directory=/ --exclude=proc --exclude=sys --exclude=dev --exclude=run /[root@localhost home]# lsbuildrpm.tar2:导入镜像cat buildrpm.tar | docker import - buildrpm。如果提示Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?则先运行docker service[root@localhost home]# service docker start3:运行[root@localhost home]# docker imagesREPOSITORY TAG IMAGE ID CREATED SIZEbuildrpm latest 15adc9614eb8 17 seconds ago 1.14 GB[root@localhost home]# docker run -it buildrpm:latest /bin/bash4删除:[root@localhost home]# docker ps -aCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES920f5a69f58d buildrpm:latest "/bin/bash" 2 minutes ago Exited (0) 2 minutes ago laughing_minsky[root@localhost home]# docker rm 920f5a69f58d920f5a69f58d[root@localhost home]# docker imagesREPOSITORY TAG IMAGE ID CREATED SIZEbuildrpm latest 15adc9614eb8 4 minutes ago 1.14 GB[root@localhost home]# docker rmi 15adc9614eb8Untagged: buildrpm:latestDeleted: sha256:15adc9614eb815974edfaca89671f86ea61e46929792c42f7515dfd65ff24688Deleted: sha256:aed61d9930e43fbf0c5d3a771b9dde602b0dda2fec6066a166d2ba9180402880[root@localhost home]# docker imagesREPOSITORY TAG IMAGE ID CREATED SIZE
转载地址:http://nsnmi.baihongyu.com/