如何设置使其弹出右键菜单

FPGA实现串口发送数据

  返回  

Docker导入、导出、删除容器

2021/8/20 15:25:36 浏览:

1、导出容器

命令:docker export
语法:docker export 容器ID >快照名.tar

[root@localhost ~]# docker ps
CONTAINER ID   IMAGE     COMMAND       CREATED          STATUS          PORTS     NAMES
22eccb66c69a   centos    "/bin/bash"   48 seconds ago   Up 45 seconds             friendly_bhabha

[root@localhost ~]# docker export 22eccb66c69a >centos.tar

[root@localhost ~]# ls
anaconda-ks.cfg  centos.tar  Dockerfile  log.txt  nginx-1.21.1.tar.gz

2、导入容器

命令:docker import
语法:cat 快照名.tar | docker import - 自定义镜像名字:版本号

[root@localhost ~]# ls
anaconda-ks.cfg  centos.tar  Dockerfile  log.txt  nginx-1.21.1.tar.gz

[root@localhost ~]# cat centos.tar | docker import - mycentos:v666
sha256:630117752a49e18aab9af058f3dbeed403c79c0d4133e5764a78244642250a1f

[root@localhost ~]# docker images
REPOSITORY   TAG       IMAGE ID       CREATED          SIZE
mycentos     v666      630117752a49   15 seconds ago   209MB
centos       latest    300e315adb2f   8 months ago     209MB

3、删除容器(批量删除)

[root@localhost ~]# docker ps
CONTAINER ID   IMAGE     COMMAND       CREATED          STATUS          PORTS     NAMES
f33deea1cccc   centos    "/bin/bash"   9 seconds ago    Up 8 seconds              lucid_sutherland
987861fcbb2b   centos    "/bin/bash"   11 seconds ago   Up 9 seconds              wonderful_curie
f70260165c0a   centos    "/bin/bash"   14 seconds ago   Up 12 seconds             tender_hamilton
22eccb66c69a   centos    "/bin/bash"   10 minutes ago   Up 10 minutes             friendly_bhabha

[root@localhost ~]# docker rm -f `docker ps -aq`
f33deea1cccc
987861fcbb2b
f70260165c0a
22eccb66c69a

[root@localhost ~]# docker ps -a
CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES

4、删除镜像(批量删除)

[root@localhost ~]# docker images
REPOSITORY   TAG       IMAGE ID       CREATED         SIZE
mycentos     v666      630117752a49   9 minutes ago   209MB
tomcat       latest    266d1269bb29   35 hours ago    668MB
redis        latest    ddcca4b8a6f0   2 days ago      105MB
nginx        latest    dd34e67e3371   2 days ago      133MB
mysql        latest    5a4e492065c7   2 days ago      514MB
httpd        latest    c8ca530172a8   2 days ago      138MB
centos       latest    300e315adb2f   8 months ago    209MB

[root@localhost ~]# docker rmi -f `docker images -aq`

注:正在使用的镜像无法删除,需要先删除容器

联系我们

如果您对我们的服务有兴趣,请及时和我们联系!

服务热线:18288888888
座机:18288888888
传真:
邮箱:888888@qq.com
地址:郑州市文化路红专路93号