标签:stat imp bsp 多少 ubunt status ima dock 导出
docker pull ubuntu
评:如不下载,在启动镜像时如果发现本地没有,会自动下载
[running]jihite@:~$ docker run -it ubuntu /bin/bash root@46db001d96f5:/# echo "hello" hello
后台启动,加参数-d, 如下边例子
问题:可以同时启动多少个容器?多个
[running]jihite@:~$ docker run -itd ubuntu /bin/bash 097ca1f3667e7edaea9c54e5861a312389444a0b3a14bd0fa6bd2bff058791e0 [running]jihite@:~$ docker run -itd ubuntu /bin/bash 372fe6e61e1e6bbbd716761f9b6855d335c8530c3e856d5c0edaef21ded83c0b [running]jihite@:~$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 372fe6e61e1e ubuntu "/bin/bash" 8 seconds ago Up 7 seconds zen_snyder 097ca1f3667e ubuntu "/bin/bash" 10 seconds ago Up 9 seconds nervous_northcutt
[running]jihite@:~$ docker stop 097ca1f3667e
097ca1f3667e
docker rm -f b5c848636e6f
[running]jihite@:~$ docker exec -it 372fe6e61e1e /bin/bash root@372fe6e61e1e:/# exit exit
docker ps
展示存活的容器,如果展示所有的,加参数-a
docker export 372fe6e61e1e > ubuntu_store.tar
容器快照372fe6e61e1e存储到本地文件
方式1: 通过本地文件导入
docker import ubuntu_store.tar test/ubuntu:v1
查看镜像
[running]jihite@:~$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
test/ubuntu v1 80e674d9a004 2 minutes ago 64.2MB
可以看到镜像里多了个刚才导入的镜像,启动下
[running]jihite@:~$ docker run -it test/ubuntu:v1 /bin/bash root@5f78cd5f746e:/#
方式2:通过远程链接导入
docker import http://example.com/exampleimage.tgz example/imagerepo
标签:stat imp bsp 多少 ubunt status ima dock 导出
原文地址:https://www.cnblogs.com/kaituorensheng/p/12630766.html