Docker在opensuse leap15.0安装手册(HappyBKs特供)

Stella981
• 阅读 695

作为一个opensuse的坚定fans,在此对docker官方文档未把opensuse及SLE平台的安装纳入文档,表示强烈不满。本文随手写了个简明手稿,供热爱opensuse的小朋友们参考。

对于连docker官网的网速我不想喷了,大家都懂。这里老老实实给出阿里云的。

拿来主义者直接复制即可,顺便把阿里云的packman一起给出,方便大家。

安装步骤如下:

linux-famw:/home/neil # zypper addrepo -f http://mirrors.aliyun.com/opensuse/update/leap/15.0/oss/ openSUSE-15.0-Update-Oss
正在添加软件源 'openSUSE-15.0-Update-Oss' .............................................................................................................................................[完毕]
成功添加了软件源 'openSUSE-15.0-Update-Oss'

URI      : http://mirrors.aliyun.com/opensuse/update/leap/15.0/oss/
已启用   : 是                                                      
GPG 检查 : 是                                                      
自动刷新 : 是                                                      
优先级   : 99 (默认优先级)                                         

软件源优先级无效。所有已启用的软件源将使用相同的优先级。
linux-famw:/home/neil # zypper addrepo -f http://mirrors.aliyun.com/opensuse/update/leap/15.0/non-oss/ openSUSE-15.0-Update-Non-Oss
正在添加软件源 'openSUSE-15.0-Update-Non-Oss' .........................................................................................................................................[完毕]
成功添加了软件源 'openSUSE-15.0-Update-Non-Oss'

URI      : http://mirrors.aliyun.com/opensuse/update/leap/15.0/non-oss/
已启用   : 是                                                          
GPG 检查 : 是                                                          
自动刷新 : 是                                                          
优先级   : 99 (默认优先级)                                             

软件源优先级无效。所有已启用的软件源将使用相同的优先级。
linux-famw:/home/neil # zypper addrepo -f http://mirrors.aliyun.com/opensuse/distribution/leap/15.0/repo/oss/ openSUSE-15.0-Oss
正在添加软件源 'openSUSE-15.0-Oss' ....................................................................................................................................................[完毕]
成功添加了软件源 'openSUSE-15.0-Oss'

URI      : http://mirrors.aliyun.com/opensuse/distribution/leap/15.0/repo/oss/
已启用   : 是                                                                 
GPG 检查 : 是                                                                 
自动刷新 : 是                                                                 
优先级   : 99 (默认优先级)                                                    

软件源优先级无效。所有已启用的软件源将使用相同的优先级。
linux-famw:/home/neil # zypper addrepo -f http://mirrors.aliyun.com/opensuse/distribution/leap/15.0/repo/non-oss/ openSUSE-15.0-Non-Oss
正在添加软件源 'openSUSE-15.0-Non-Oss' ................................................................................................................................................[完毕]
成功添加了软件源 'openSUSE-15.0-Non-Oss'
                                                                                                                                                                                             
URI      : http://mirrors.aliyun.com/opensuse/distribution/leap/15.0/repo/non-oss/                                                                                                           
已启用   : 是                                                                                                                                                                                
GPG 检查 : 是                                                                                                                                                                                
自动刷新 : 是                                                                                                                                                                                
优先级   : 99 (默认优先级)                                                                                                                                                                   
                                                                                                                                                                                             
软件源优先级无效。所有已启用的软件源将使用相同的优先级。                                                                                                                                     
linux-famw:/home/neil #                                                                                                                                                                      
linux-famw:/home/neil #                                                                                                                                                                      
linux-famw:/home/neil # zypper addrepo -f http://mirrors.aliyun.com/packman/openSUSE_Leap_15.0/ aliyun-packman
正在添加软件源 'aliyun-packman' .......................................................................................................................................................[完毕]
成功添加了软件源 'aliyun-packman'

URI      : http://mirrors.aliyun.com/packman/openSUSE_Leap_15.0/
已启用   : 是                                                   
GPG 检查 : 是                                                   
自动刷新 : 是                                                   
优先级   : 99 (默认优先级)                                      

软件源优先级无效。所有已启用的软件源将使用相同的优先级。
linux-famw:/home/neil # 
linux-famw:/home/neil # 
linux-famw:/home/neil # 
linux-famw:/home/neil # zypper in docker
正在检索软件源 'aliyun-packman' 的元数据 ..............................................................................................................................................[完毕]
正在构建软件源 'aliyun-packman' 的缓存 ................................................................................................................................................[完毕]
正在检索软件源 'openSUSE-15.0-Non-Oss' 的元数据 .......................................................................................................................................[完毕]
正在构建软件源 'openSUSE-15.0-Non-Oss' 的缓存 .........................................................................................................................................[完毕]
正在检索软件源 'openSUSE-15.0-Oss' 的元数据 ...........................................................................................................................................[完毕]
正在构建软件源 'openSUSE-15.0-Oss' 的缓存 .............................................................................................................................................[完毕]
正在检索软件源 'openSUSE-15.0-Update-Non-Oss' 的元数据 ................................................................................................................................[完毕]
正在构建软件源 'openSUSE-15.0-Update-Non-Oss' 的缓存 ..................................................................................................................................[完毕]
正在检索软件源 'openSUSE-15.0-Update-Oss' 的元数据 ....................................................................................................................................[完毕]
正在构建软件源 'openSUSE-15.0-Update-Oss' 的缓存 ......................................................................................................................................[完毕]
正在检索软件源 'openSUSE-Leap-15.0-Update' 的元数据 ...................................................................................................................................[完毕]
正在构建软件源 'openSUSE-Leap-15.0-Update' 的缓存 .....................................................................................................................................[完毕]
正在加载软件源数据...
正在读取已安装的软件包...
正在解决软件包依赖关系...

将安装以下 17 个新软件包:
  catatonit containerd criu docker docker-bash-completion docker-libnetwork docker-runc git-core git-gui gitk libnet9 libpcre2-8-0 libprotobuf-c1 libsha1detectcoll1 perl-Error
  python2-ipaddr python2-protobuf

自动选中了以下 1 个推荐软件包:
  criu

17 个软件包将新装.
总下载大小:23.9 MiB。已缓存:0 B。 操作完成后,将使用额外的 118.7 MiB。
继续吗? [y/n/...? 显示全部选项] (y): y
正在检索 软件包 catatonit-0.1.3-lp150.1.1.x86_64                                                                                                       (1/17), 257.3 KiB (解压后 699.9 KiB)
正在检索: catatonit-0.1.3-lp150.1.1.x86_64.rpm .......................................................................................................................................[完毕]
正在检索 软件包 docker-libnetwork-0.7.0.1+gitr2066_7b2b1feb1de4-lp150.2.1.x86_64                                                                       (2/17), 477.2 KiB (解压后   1.5 MiB)
正在检索: docker-libnetwork-0.7.0.1+gitr2066_7b2b1feb1de4-lp150.2.1.x86_64.rpm .............................................................................................[完毕 (744 B/s)]
正在检索 软件包 libnet9-1.2~rc3-lp150.1.8.x86_64                                                                                                       (3/17),  44.7 KiB (解压后 100.2 KiB)
正在检索: libnet9-1.2~rc3-lp150.1.8.x86_64.rpm .......................................................................................................................................[完毕]
正在检索 软件包 libpcre2-8-0-10.31-lp150.1.3.x86_64                                                                                                    (4/17), 235.5 KiB (解压后 648.1 KiB)
正在检索: libpcre2-8-0-10.31-lp150.1.3.x86_64.rpm ....................................................................................................................................[完毕]
正在检索 软件包 libprotobuf-c1-1.3.0-lp150.1.4.x86_64                                                                                                  (5/17),  28.1 KiB (解压后  35.8 KiB)
正在检索: libprotobuf-c1-1.3.0-lp150.1.4.x86_64.rpm ..................................................................................................................................[完毕]
正在检索 软件包 libsha1detectcoll1-1.0.3-lp150.2.2.x86_64                                                                                              (6/17),  23.2 KiB (解压后  45.8 KiB)
正在检索: libsha1detectcoll1-1.0.3-lp150.2.2.x86_64.rpm ..............................................................................................................................[完毕]
正在检索 软件包 perl-Error-0.17025-lp150.1.6.noarch                                                                                                    (7/17),  40.5 KiB (解压后  70.5 KiB)
正在检索: perl-Error-0.17025-lp150.1.6.noarch.rpm ....................................................................................................................................[完毕]
正在检索 软件包 python2-ipaddr-2.1.11-lp150.1.3.noarch                                                                                                 (8/17),  37.6 KiB (解压后 193.7 KiB)
正在检索: python2-ipaddr-2.1.11-lp150.1.3.noarch.rpm .................................................................................................................................[完毕]
正在检索 软件包 python2-protobuf-3.5.0-lp150.3.4.x86_64                                                                                                (9/17), 493.0 KiB (解压后   4.0 MiB)
正在检索: python2-protobuf-3.5.0-lp150.3.4.x86_64.rpm ......................................................................................................................[完毕 (859 B/s)]
正在检索 软件包 criu-3.8.1-lp150.1.1.x86_64                                                                                                           (10/17), 596.5 KiB (解压后   2.3 MiB)
正在检索: criu-3.8.1-lp150.1.1.x86_64.rpm ............................................................................................................................................[完毕]
正在检索 软件包 docker-runc-1.0.0rc4+gitr3338_3f2f8b84a77f-lp150.4.2.x86_64                                                                           (11/17),   1.6 MiB (解压后   6.9 MiB)
正在检索: docker-runc-1.0.0rc4+gitr3338_3f2f8b84a77f-lp150.4.2.x86_64.rpm ............................................................................................................[完毕]
正在检索 软件包 containerd-0.2.9+gitr706_06b9cb351610-lp150.3.3.x86_64                                                                                (12/17),   2.8 MiB (解压后  13.1 MiB)
正在检索: containerd-0.2.9+gitr706_06b9cb351610-lp150.3.3.x86_64.rpm .................................................................................................................[完毕]
正在检索 软件包 git-core-2.16.4-lp150.2.3.1.x86_64                                                                                                    (13/17),   3.9 MiB (解压后  23.1 MiB)
正在检索: git-core-2.16.4-lp150.2.3.1.x86_64.rpm .........................................................................................................................[完毕 (1.1 MiB/s)]
正在检索 软件包 gitk-2.16.4-lp150.2.3.1.x86_64                                                                                                        (14/17), 246.7 KiB (解压后 735.0 KiB)
正在检索: gitk-2.16.4-lp150.2.3.1.x86_64.rpm .........................................................................................................................................[完毕]
正在检索 软件包 git-gui-2.16.4-lp150.2.3.1.x86_64                                                                                                     (15/17), 311.0 KiB (解压后   1.2 MiB)
正在检索: git-gui-2.16.4-lp150.2.3.1.x86_64.rpm ......................................................................................................................................[完毕]
正在检索 软件包 docker-17.09.1_ce-lp150.4.2.x86_64                                                                                                    (16/17),  12.7 MiB (解压后  64.0 MiB)
正在检索: docker-17.09.1_ce-lp150.4.2.x86_64.rpm .........................................................................................................................[完毕 (2.8 MiB/s)]
正在检索 软件包 docker-bash-completion-17.09.1_ce-lp150.4.2.noarch                                                                                    (17/17), 150.1 KiB (解压后  98.6 KiB)
正在检索: docker-bash-completion-17.09.1_ce-lp150.4.2.noarch.rpm ...........................................................................................................[完毕 (860 B/s)]
正在检查文件冲突: ....................................................................................................................................................................[完毕]
( 1/17) 正在安装:catatonit-0.1.3-lp150.1.1.x86_64 ....................................................................................................................................[完毕]
( 2/17) 正在安装:docker-libnetwork-0.7.0.1+gitr2066_7b2b1feb1de4-lp150.2.1.x86_64 ....................................................................................................[完毕]
( 3/17) 正在安装:libnet9-1.2~rc3-lp150.1.8.x86_64 ....................................................................................................................................[完毕]
( 4/17) 正在安装:libpcre2-8-0-10.31-lp150.1.3.x86_64 .................................................................................................................................[完毕]
( 5/17) 正在安装:libprotobuf-c1-1.3.0-lp150.1.4.x86_64 ...............................................................................................................................[完毕]
( 6/17) 正在安装:libsha1detectcoll1-1.0.3-lp150.2.2.x86_64 ...........................................................................................................................[完毕]
( 7/17) 正在安装:perl-Error-0.17025-lp150.1.6.noarch .................................................................................................................................[完毕]
( 8/17) 正在安装:python2-ipaddr-2.1.11-lp150.1.3.noarch ..............................................................................................................................[完毕]
( 9/17) 正在安装:python2-protobuf-3.5.0-lp150.3.4.x86_64 .............................................................................................................................[完毕]
(10/17) 正在安装:criu-3.8.1-lp150.1.1.x86_64 .........................................................................................................................................[完毕]
(11/17) 正在安装:docker-runc-1.0.0rc4+gitr3338_3f2f8b84a77f-lp150.4.2.x86_64 .........................................................................................................[完毕]
(12/17) 正在安装:containerd-0.2.9+gitr706_06b9cb351610-lp150.3.3.x86_64 ..............................................................................................................[完毕]
额外的 RPM 输出:
Updating /etc/sysconfig/containerd ...                                                                                                                                                       


(13/17) 正在安装:git-core-2.16.4-lp150.2.3.1.x86_64 ..................................................................................................................................[完毕]
(14/17) 正在安装:gitk-2.16.4-lp150.2.3.1.x86_64 ......................................................................................................................................[完毕]
(15/17) 正在安装:git-gui-2.16.4-lp150.2.3.1.x86_64 ...................................................................................................................................[完毕]
(16/17) 正在安装:docker-17.09.1_ce-lp150.4.2.x86_64 ..................................................................................................................................[完毕]
额外的 RPM 输出:
Updating /etc/sysconfig/docker ...                                                                                                                                                           


(17/17) 正在安装:docker-bash-completion-17.09.1_ce-lp150.4.2.noarch ..................................................................................................................[完毕]
linux-famw:/home/neil # 

启动 docker 守护进程

linux-famw:/home/neil # systemctl start docker.service
linux-famw:/home/neil # 

配置让 docker 服务随系统自动启动

linux-famw:/home/neil # systemctl enable docker.service
Created symlink /etc/systemd/system/multi-user.target.wants/docker.service → /usr/lib/systemd/system/docker.service.
linux-famw:/home/neil # 

docker 会创建一个以docker命名的用户组,添加用户到这个用户组

linux-famw:/home/neil # /usr/sbin/usermod -a -G docker neil
linux-famw:/home/neil # 

基本命令整理

敲击三个最简单命令查看安装效果

查看docker版本信息

linux-famw:/home/neil # docker version
Client:
 Version:      17.09.1-ce
 API version:  1.32
 Go version:   go1.8.7
 Git commit:   f4ffd2511ce9
 Built:        Thu Apr 19 12:00:00 2018
 OS/Arch:      linux/amd64

Server:
 Version:      17.09.1-ce
 API version:  1.32 (minimum version 1.12)
 Go version:   go1.8.7
 Git commit:   f4ffd2511ce9
 Built:        Thu Apr 19 12:00:00 2018
 OS/Arch:      linux/amd64
 Experimental: false
linux-famw:/home/neil # 

查看详细信息

里面包含了更为详细的信息。如你有多少容器,镜像有多少个。

linux-famw:/home/neil # docker info
Containers: 0
 Running: 0
 Paused: 0
 Stopped: 0
Images: 0
Server Version: 17.09.1-ce
Storage Driver: btrfs
 Build Version: Btrfs v4.15
 Library Version: 102
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: inactive
Runtimes: oci runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 06b9cb35161009dcb7123345749fef02f7cea8e0
runc version: 3f2f8b84a77f73d38244dd690525642a72156c64
init version: v0.1.3_catatonit (expected: 949e6facb77383876aeff8a6944dde66b3089574)
Security Options:
 apparmor
 seccomp
  Profile: default
Kernel Version: 4.12.14-lp150.12.7-default
Operating System: openSUSE Leap 15.0
OSType: linux
Architecture: x86_64
CPUs: 8
Total Memory: 7.661GiB
Name: linux-famw
ID: 6F47:5K4Z:Q6YA:X3FD:K736:I2VN:HUJ3:CU4M:CK5S:5YCO:XI4J:ZEEF
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false

WARNING: No swap limit support
linux-famw:/home/neil # 

docker帮助命令

就像linux命令帮助找man一样。docker命令记不住了,如下:

linux-famw:/home/neil # docker --help

Usage:  docker COMMAND

A self-sufficient runtime for containers

Options:
      --config string      Location of client config files (default "/root/.docker")
  -D, --debug              Enable debug mode
      --help               Print usage
  -H, --host list          Daemon socket(s) to connect to
  -l, --log-level string   Set the logging level ("debug"|"info"|"warn"|"error"|"fatal") (default "info")
      --tls                Use TLS; implied by --tlsverify
      --tlscacert string   Trust certs signed only by this CA (default "/root/.docker/ca.pem")
      --tlscert string     Path to TLS certificate file (default "/root/.docker/cert.pem")
      --tlskey string      Path to TLS key file (default "/root/.docker/key.pem")
      --tlsverify          Use TLS and verify the remote
  -v, --version            Print version information and quit

Management Commands:
  config      Manage Docker configs
  container   Manage containers
  image       Manage images
  network     Manage networks
  node        Manage Swarm nodes
  plugin      Manage plugins
  secret      Manage Docker secrets
  service     Manage services
  stack       Manage Docker stacks
  swarm       Manage Swarm
  system      Manage Docker
  volume      Manage volumes

Commands:
  attach      Attach local standard input, output, and error streams to a running container
  build       Build an image from a Dockerfile
  commit      Create a new image from a container's changes
  cp          Copy files/folders between a container and the local filesystem
  create      Create a new container
  diff        Inspect changes to files or directories on a container's filesystem
  events      Get real time events from the server
  exec        Run a command in a running container
  export      Export a container's filesystem as a tar archive
  history     Show the history of an image
  images      List images
  import      Import the contents from a tarball to create a filesystem image
  info        Display system-wide information
  inspect     Return low-level information on Docker objects
  kill        Kill one or more running containers
  load        Load an image from a tar archive or STDIN
  login       Log in to a Docker registry
  logout      Log out from a Docker registry
  logs        Fetch the logs of a container
  pause       Pause all processes within one or more containers
  port        List port mappings or a specific mapping for the container
  ps          List containers
  pull        Pull an image or a repository from a registry
  push        Push an image or a repository to a registry
  rename      Rename a container
  restart     Restart one or more containers
  rm          Remove one or more containers
  rmi         Remove one or more images
  run         Run a command in a new container
  save        Save one or more images to a tar archive (streamed to STDOUT by default)
  search      Search the Docker Hub for images
  start       Start one or more stopped containers
  stats       Display a live stream of container(s) resource usage statistics
  stop        Stop one or more running containers
  tag         Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE
  top         Display the running processes of a container
  unpause     Unpause all processes within one or more containers
  update      Update configuration of one or more containers
  version     Show the Docker version information
  wait        Block until one or more containers stop, then print their exit codes

Run 'docker COMMAND --help' for more information on a command.
linux-famw:/home/neil # 

镜像命令

docker images 查询本地镜像

linux-famw:/home/neil # docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
tomcat              latest              f3159377bac1        3 days ago          462MB
linux-famw:/home/neil # 

Repository 表示镜像的仓库源
TAG镜像的标签
IMAGE ID 镜像ID
CREATED:镜像创建时间
SIZE:镜像大小

查询命令还有其他参数:

-a 列出本地所有镜像。镜像是分层的,如要全部显示,需要添加这个参数。
-q 只显示镜像ID。组合使用-qa也可,特别是在删除镜像时,需要按照image id删除,这个时候会很有用。
--digest 显示镜像的摘要信息
--no-trunc 显示完整的镜像信息

docker search 搜索远程仓库镜像资源

docker search 某个镜像的名字

docker这个查找image资源的功能,和maven去mvn中央库下jar包有点类似。

但这里有个需要注意的地方是,虽然我们刚才为了下载更快,将本地的docker的仓库配置为阿里云,但是搜索操作还是会去https://hub.docker.com/搜索,然后再去阿里云上下载对应的镜像资源。

Docker在opensuse leap15.0安装手册(HappyBKs特供)

我们可以用命令搜索:

就像mvn中央库、github一样,全球的开发着和组织会将docker的镜像资源上传到docker hub上。比如我这里搜索tomcat的镜像image。

这里注意的是,OFFICAL列给出了这个docker image是不是官方提供的,AUTOMATED代表是不是自动构建的。

neil@linux-famw:~> docker search tomcat
NAME                                  DESCRIPTION                                     STARS               OFFICIAL            AUTOMATED
tomcat                                Apache Tomcat is an open source implementa...   1963                [OK]                
tomee                                 Apache TomEE is an all-Apache Java EE cert...   53                  [OK]                
dordoka/tomcat                        Ubuntu 14.04, Oracle JDK 8 and Tomcat 8 ba...   49                                      [OK]
davidcaste/alpine-tomcat              Apache Tomcat 7/8 using Oracle Java 7/8 wi...   29                                      [OK]
bitnami/tomcat                        Bitnami Tomcat Docker Image                     20                                      [OK]
consol/tomcat-7.0                     Tomcat 7.0.57, 8080, "admin/admin"              16                                      [OK]
cloudesire/tomcat                     Tomcat server, 6/7/8                            15                                      [OK]
tutum/tomcat                          Base docker image to run a Tomcat applicat...   10                                      
meirwa/spring-boot-tomcat-mysql-app   a sample spring-boot app using tomcat and ...   10                                      [OK]
jeanblanchard/tomcat                  Minimal Docker image with Apache Tomcat         8                                       
aallam/tomcat-mysql                   Debian, Oracle JDK, Tomcat & MySQL              7                                       [OK]
rightctrl/tomcat                      CentOS , Oracle Java, tomcat application s...   3                                       [OK]
maluuba/tomcat7-java8                 Tomcat7 with java8.                             2                                       
arm64v8/tomcat                        Apache Tomcat is an open source implementa...   2                                       
amd64/tomcat                          Apache Tomcat is an open source implementa...   2                                       
99taxis/tomcat7                       Tomcat7                                         1                                       [OK]
primetoninc/tomcat                    Apache tomcat 8.5, 8.0, 7.0                     1                                       [OK]
fabric8/tomcat-8                      Fabric8 Tomcat 8 Image                          1                                       [OK]
swisstopo/service-print-tomcat        backend tomcat for service-print "the true...   0                                       
jelastic/tomcat                                                                       0                                       
oobsri/tomcat8                        Testing CI Jobs with different names.           0                                       
s390x/tomcat                          Apache Tomcat is an open source implementa...   0                                       
picoded/tomcat7                       tomcat7 with jre8 and MANAGER_USER / MANAG...   0                                       [OK]
cfje/tomcat-resource                  Tomcat Concourse Resource                       0                                       
trollin/tomcat                                                                        0                                       
neil@linux-famw:~>

-s 列出收藏数不小于指定数的镜像。

--no-trunc 显示完整的镜像。

-- 只列出自动构建类型镜像。

neil@linux-famw:~> docker search -s 20 --no-trunc tomcat                                                                                                                                   
Flag --stars has been deprecated, use --filter=stars=3 instead                                                                                                                               
NAME                       DESCRIPTION                                                                                            STARS               OFFICIAL            AUTOMATED          
tomcat                     Apache Tomcat is an open source implementation of the Java Servlet and JavaServer Pages technologies   1963                [OK]                                   
tomee                      Apache TomEE is an all-Apache Java EE certified stack where Apache Tomcat is top dog.                  53                  [OK]                                   
dordoka/tomcat             Ubuntu 14.04, Oracle JDK 8 and Tomcat 8 based docker container.                                        49                                      [OK]               
davidcaste/alpine-tomcat   Apache Tomcat 7/8 using Oracle Java 7/8 with GLIBC 2.21 over Alpine with unlimited JCE patch applied   29                                      [OK]               
bitnami/tomcat             Bitnami Tomcat Docker Image                                                                            20                                      [OK]               
neil@linux-famw:~>   

这里可以看到tomcat docker的镜像也是一层层叠加起来的,下一篇讲联合镜像系统的时候再说。

linux-famw:/home/neil # docker pull tomcat
Using default tag: latest
latest: Pulling from library/tomcat
55cbf04beb70: Pull complete 
1607093a898c: Pull complete 
9a8ea045c926: Pull complete 
1290813abd9d: Pull complete 
8a6b982ad6d7: Pull complete 
abb029e68402: Pull complete 
8cd067dc06dc: Pull complete 
1b9ce2097b98: Pull complete 
d6db5874b692: Pull complete 
25b4aa3d52c5: Pull complete 
cb92b5a7cbd7: Pull complete 
7f4c6a7a42de: Pull complete 
Digest: sha256:73371bc88ce89aab6568ac22ed40522526a568db9e33de4dd013003ba77e7ff0
Status: Downloaded newer image for tomcat:latest
linux-famw:/home/neil # 
linux-famw:/home/neil # 
linux-famw:/home/neil # docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
tomcat              latest              f3159377bac1        3 days ago          462MB
linux-famw:/home/neil # 

删除镜像

docker rmi 镜像名称

如果要删除的镜像正在被使用,则无法成功删除。这时候如果要强制删除,需要用命令:

docker rmi -f 镜像名称

删除多个镜像:

docker rmi -f 镜像名称1 镜像名称2

如果要带TAG,则:

docker rmi -f 镜像名称1:TAG1 镜像名称2:TAG2

如果要按照查询命令结果的镜像id列表来删除,可以这样:有点像sql子查询,和linux管道命令

docker rmi -f ${docker search -qa 镜像名称}

点赞
收藏
评论区
推荐文章
blmius blmius
3年前
MySQL:[Err] 1292 - Incorrect datetime value: ‘0000-00-00 00:00:00‘ for column ‘CREATE_TIME‘ at row 1
文章目录问题用navicat导入数据时,报错:原因这是因为当前的MySQL不支持datetime为0的情况。解决修改sql\mode:sql\mode:SQLMode定义了MySQL应支持的SQL语法、数据校验等,这样可以更容易地在不同的环境中使用MySQL。全局s
皕杰报表之UUID
​在我们用皕杰报表工具设计填报报表时,如何在新增行里自动增加id呢?能新增整数排序id吗?目前可以在新增行里自动增加id,但只能用uuid函数增加UUID编码,不能新增整数排序id。uuid函数说明:获取一个UUID,可以在填报表中用来创建数据ID语法:uuid()或uuid(sep)参数说明:sep布尔值,生成的uuid中是否包含分隔符'',缺省为
待兔 待兔
4个月前
手写Java HashMap源码
HashMap的使用教程HashMap的使用教程HashMap的使用教程HashMap的使用教程HashMap的使用教程22
Jacquelyn38 Jacquelyn38
3年前
2020年前端实用代码段,为你的工作保驾护航
有空的时候,自己总结了几个代码段,在开发中也经常使用,谢谢。1、使用解构获取json数据let jsonData  id: 1,status: "OK",data: 'a', 'b';let  id, status, data: number   jsonData;console.log(id, status, number )
Stella981 Stella981
3年前
KVM调整cpu和内存
一.修改kvm虚拟机的配置1、virsheditcentos7找到“memory”和“vcpu”标签,将<namecentos7</name<uuid2220a6d1a36a4fbb8523e078b3dfe795</uuid
Wesley13 Wesley13
3年前
mysql设置时区
mysql设置时区mysql\_query("SETtime\_zone'8:00'")ordie('时区设置失败,请联系管理员!');中国在东8区所以加8方法二:selectcount(user\_id)asdevice,CONVERT\_TZ(FROM\_UNIXTIME(reg\_time),'08:00','0
Wesley13 Wesley13
3年前
00:Java简单了解
浅谈Java之概述Java是SUN(StanfordUniversityNetwork),斯坦福大学网络公司)1995年推出的一门高级编程语言。Java是一种面向Internet的编程语言。随着Java技术在web方面的不断成熟,已经成为Web应用程序的首选开发语言。Java是简单易学,完全面向对象,安全可靠,与平台无关的编程语言。
Stella981 Stella981
3年前
Django中Admin中的一些参数配置
设置在列表中显示的字段,id为django模型默认的主键list_display('id','name','sex','profession','email','qq','phone','status','create_time')设置在列表可编辑字段list_editable
Wesley13 Wesley13
3年前
MySQL部分从库上面因为大量的临时表tmp_table造成慢查询
背景描述Time:20190124T00:08:14.70572408:00User@Host:@Id:Schema:sentrymetaLast_errno:0Killed:0Query_time:0.315758Lock_
Python进阶者 Python进阶者
10个月前
Excel中这日期老是出来00:00:00,怎么用Pandas把这个去除
大家好,我是皮皮。一、前言前几天在Python白银交流群【上海新年人】问了一个Pandas数据筛选的问题。问题如下:这日期老是出来00:00:00,怎么把这个去除。二、实现过程后来【论草莓如何成为冻干莓】给了一个思路和代码如下:pd.toexcel之前把这