docker镜像操作

Posted ilifeilong

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了docker镜像操作相关的知识,希望对你有一定的参考价值。

仓库配置文件默认值为docker官方镜像地址

# cat /etc/docker/daemon.json 
{
  "registry-mirror": [
    "https://registry.docker-cn.com"
  ]
}

查看centos镜像

# docker search centos
NAME                               DESCRIPTION                                     STARS               OFFICIAL            AUTOMATED
centos                             The official build of CentOS.                   5615                [OK]                
ansible/centos7-ansible            Ansible on Centos7                              124                                     [OK]
jdeathe/centos-ssh                 OpenSSH / Supervisor / EPEL/IUS/SCL Repos - …   113                                     [OK]
consol/centos-xfce-vnc             Centos container with "headless" VNC session…   99                                      [OK]
centos/mysql-57-centos7            MySQL 5.7 SQL database server                   63                                      
imagine10255/centos6-lnmp-php56    centos6-lnmp-php56                              57                                      [OK]
tutum/centos                       Simple CentOS docker image with SSH access      44                                      
centos/postgresql-96-centos7       PostgreSQL is an advanced Object-Relational …   39                                      
kinogmt/centos-ssh                 CentOS with SSH                                 29                                      [OK]
centos/php-56-centos7              Platform for building and running PHP 5.6 ap…   22                                      
pivotaldata/centos-gpdb-dev        CentOS image for GPDB development. Tag names…   10                                      
drecom/centos-ruby                 centos ruby                                     6                                       [OK]
centos/tools                       Docker image that has systems administration…   4                                       [OK]
darksheer/centos                   Base Centos Image -- Updated hourly             3                                       [OK]
mamohr/centos-java                 Oracle Java 8 Docker image based on Centos 7    3                                       [OK]
pivotaldata/centos                 Base centos, freshened up a little with a Do…   3                                       
pivotaldata/centos-mingw           Using the mingw toolchain to cross-compile t…   2                                       
miko2u/centos6                     CentOS6 日本語環境                                   2                                       [OK]
pivotaldata/centos-gcc-toolchain   CentOS with a toolchain, but unaffiliated wi…   2                                       
mcnaughton/centos-base             centos base image                               1                                       [OK]
indigo/centos-maven                Vanilla CentOS 7 with Oracle Java Developmen…   1                                       [OK]
blacklabelops/centos               CentOS Base Image! Built and Updates Daily!     1                                       [OK]
pivotaldata/centos7-dev            CentosOS 7 image for GPDB development           0                                       
smartentry/centos                  centos with smartentry                          0                                       [OK]
pivotaldata/centos6.8-dev          CentosOS 6.8 image for GPDB development         0                                       

下载centos镜像

# docker pull centos
Using default tag: latest
latest: Pulling from library/centos
729ec3a6ada3: Pull complete 
Digest: sha256:f94c1d992c193b3dc09e297ffd54d8a4f1dc946c37cbeceb26d35ce1647f88d9
Status: Downloaded newer image for centos:latest
docker.io/library/centos:latest

查看下载的镜像

# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
centos              latest              0f3e07c0138f        2 weeks ago         220MB

为镜像创建一个新的tag

# docker tag centos:latest centos:version7
# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
centos              latest              0f3e07c0138f        2 weeks ago         220MB
centos              version7            0f3e07c0138f        2 weeks ago         220MB

删除镜像

# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
centos              latest              0f3e07c0138f        2 weeks ago         220MB
centos              version7            0f3e07c0138f        2 weeks ago         220MB
# docker rmi centos:latest
Untagged: centos:latest
# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
centos              version7            0f3e07c0138f        2 weeks ago         220MB

 

以上是关于docker镜像操作的主要内容,如果未能解决你的问题,请参考以下文章

Docker——Docker组件Docker安装与启动

Docker 基本操作 镜像操作 -- docker镜像命令

Docker基本管理(容器及镜像操作)

Docker基本管理(容器及镜像操作)

docker--镜像操作

Docker镜像管理