常用镜像管理命令
搜索镜像
[root@localhost ~]# docker search centos
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
centos The official build of CentOS. 4419 [OK]
ansible/centos7-ansible Ansible on Centos7 113 [OK]
jdeathe/centos-ssh CentOS-6 6.9 x86_64 / CentOS-7 7.4.1708 x86_… 97 [OK]
consol/centos-xfce-vnc Centos container with "headless" VNC session… 55 [OK]
tutum/centos Simple CentOS docker image with SSH access 42
imagine10255/centos6-lnmp-php56 centos6-lnmp-php56 41 [OK]
centos/mysql-57-centos7 MySQL 5.7 SQL database server 31
gluster/gluster-centos Official GlusterFS Image [ CentOS-7 + Glust… 30 [OK]
openshift/base-centos7 A Centos7 derived base image for Source-To-I… 27
centos/python-35-centos7 Platform for building and running Python 3.5… 24
kinogmt/centos-ssh CentOS with SSH 21 [OK]
centos/postgresql-96-centos7 PostgreSQL is an advanced Object-Relational … 19
openshift/jenkins-2-centos7 A Centos7 based Jenkins v2.x image for use w… 13
openshift/mysql-55-centos7 DEPRECATED: A Centos7 based MySQL v5.5 image… 6
pivotaldata/centos-gpdb-dev CentOS image for GPDB development. Tag names… 4
openshift/jenkins-1-centos7 DEPRECATED: A Centos7 based Jenkins v1.x ima… 4
darksheer/centos Base Centos Image -- Updated hourly 3 [OK]
openshift/wildfly-101-centos7 A Centos7 based WildFly v10.1 image for use … 3
pivotaldata/centos Base centos, freshened up a little with a Do… 2
openshift/wildfly-81-centos7 A Centos7 based WildFly v8.1 image for use w… 1
blacklabelops/centos CentOS Base Image! Built and Updates Daily! 1 [OK]
pivotaldata/centos-mingw Using the mingw toolchain to cross-compile t… 1
jameseckersall/sonarr-centos Sonarr on CentOS 7 0 [OK]
smartentry/centos centos with smartentry 0 [OK]
pivotaldata/centos-gcc-toolchain CentOS with a toolchain, but unaffiliated wi… 0
获取镜像
[root@localhost ~]# docker pull centos
Using default tag: latest
latest: Pulling from library/centos
7dc0dca2b151: Pull complete
Digest: sha256:b67d21dfe609ddacf404589e04631d90a342921e81c40aeaf3391f6717fa5322
Status: Downloaded newer image for centos:latest
运行镜像
[root@localhost ~]# docker run -it --rm centos bash
[root@5be86574f0a3 /]# cat /etc/os-release
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"
CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"
[root@5be86574f0a3 /]# exit
查看镜像
[root@localhost ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
centos latest 49f7960eb7e4 3 weeks ago 200MB
删除镜像
[root@localhost ~]# docker rmi centos
Untagged: centos:latest
Untagged: centos@sha256:b67d21dfe609ddacf404589e04631d90a342921e81c40aeaf3391f6717fa5322
Deleted: sha256:49f7960eb7e4cb46f1a02c1f8174c6fac07ebf1eb6d8deffbcb5c695f1c9edd5
Deleted: sha256:bcc97fbfc9e1a709f0eb78c1da59caeb65f43dc32cd5deeb12b8c1784e5b8