Docker在opensuse leap15.0安裝手冊(HappyBKs特供白白)

做爲一個opensuse的堅決fans,在此對docker官方文檔未把opensuse及SLE平臺的安裝歸入文檔,表示強烈不滿。本文隨手寫了個簡明手稿,供熱愛opensuse的小朋友們參考。java

對於連docker官網的網速我不想噴了,你們都懂。這裏老老實實給出阿里雲的。node

拿來主義者直接複製便可,順便把阿里雲的packman一塊兒給出,方便你們。python

安裝步驟以下:

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 #

 

基本命令整理

敲擊三個最簡單命令查看安裝效果mysql

查看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

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命令記不住了,以下:git

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:鏡像大小github

 

查詢命令還有其餘參數:spring

-a 列出本地全部鏡像。鏡像是分層的,如要所有顯示,須要添加這個參數。
-q 只顯示鏡像ID。組合使用-qa也可,特別是在刪除鏡像時,須要按照image id刪除,這個時候會頗有用。
--digest 顯示鏡像的摘要信息
--no-trunc 顯示完整的鏡像信息sql

 

docker search 搜索遠程倉庫鏡像資源

docker search 某個鏡像的名字docker

docker這個查找image資源的功能,和maven去mvn中央庫下jar包有點相似。

但這裏有個須要注意的地方是,雖然咱們剛纔爲了下載更快,將本地的docker的倉庫配置爲阿里雲,可是搜索操做仍是會去https://hub.docker.com/搜索,而後再去阿里雲上下載對應的鏡像資源。

 

咱們能夠用命令搜索:

就像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 鏡像名稱}

相關文章
相關標籤/搜索