2.1 查看镜像
[[email protected] ~]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE docker.io/hello-world latest 05a3bd381fc2 5 weeks ago 1.84 kB
选项说明:
REPOSTITORY:表示镜像的仓库源
TAG:镜像的标签
IMAGE ID:镜像ID
CREATED:镜像创建时间
SIZE:镜像大小
同一仓库源可以有多个 TAG,代表这个仓库源的不同个版本,如ubuntu仓库源里,有15.10、14.04等多个不同的版本,我们使用 REPOSTITORY:TAG 来定义不同的镜像。
2.2 搜索镜像
[[email protected] ~]# docker search centos ##搜索方式docker search [镜像名字] (下载次数) (官方) (自动化) INDEX NAME DESCRIPTION STARS OFFICIAL AUTOMATED docker.io docker.io/centos The official build of CentOS. 3734 [OK] docker.io docker.io/ansible/centos7-ansible Ansible on Centos7 102 [OK] docker.io docker.io/jdeathe/centos-ssh CentOS-6 6.9 x86_64 / CentOS-7 7.4.1708 x8... 87 [OK] docker.io docker.io/tutum/centos Simple CentOS docker image with SSH access 33 docker.io docker.io/imagine10255/centos6-lnmp-php56 centos6-lnmp-php56 31 [OK] docker.io docker.io/gluster/gluster-centos Official GlusterFS Image [ CentOS-7 + Glu... 20 [OK] docker.io docker.io/kinogmt/centos-ssh CentOS with SSH 17 [OK] docker.io docker.io/centos/php-56-centos7 Platform for building and running PHP 5.6 ... 10 docker.io docker.io/openshift/base-centos7 A Centos7 derived base image for Source-To... 10 docker.io docker.io/centos/python-35-centos7 Platform for building and running Python 3... 9 docker.io docker.io/openshift/mysql-55-centos7 DEPRECATED: A Centos7 based MySQL v5.5 ima... 6 docker.io docker.io/openshift/jenkins-2-centos7 A Centos7 based Jenkins v2.x image for use... 5 docker.io docker.io/darksheer/centos Base Centos Image -- Updated hourly 3 [OK] docker.io docker.io/openshift/ruby-20-centos7 DEPRECATED: A Centos7 based Ruby v2.0 imag... 3 docker.io docker.io/blacklabelops/centos CentOS Base Image! Built and Updates Daily! 1 [OK] docker.io docker.io/indigo/centos-maven Vanilla CentOS 7 with Oracle Java Developm... 1 [OK] docker.io docker.io/miko2u/centos6 CentOS6 日本語環境 1 [OK] docker.io docker.io/openshift/php-55-centos7 DEPRECATED: A Centos7 based PHP v5.5 image... 1 docker.io docker.io/pivotaldata/centos-gpdb-dev CentOS image for GPDB development. Tag nam... 1 docker.io docker.io/pivotaldata/centos-mingw Using the mingw toolchain to cross-compile... 1 docker.io docker.io/jameseckersall/sonarr-centos Sonarr on CentOS 7 0 [OK] docker.io docker.io/openshift/wildfly-101-centos7 A Centos7 based WildFly v10.1 image for us... 0 docker.io docker.io/pivotaldata/centos Base centos, freshened up a little with a ... 0 docker.io docker.io/pivotaldata/centos-gcc-toolchain CentOS with a toolchain, but unaffiliated ... 0 docker.io docker.io/smartentry/centos centos with smartentry 0 [OK] docker search : 从Docker Hub查找镜像
语法
docker search [OPTIONS] TERM
选项说明:
--automated :只列出 automated build类型的镜像;
--no-trunc :显示完整的镜像描述;
-s :列出收藏数不小于指定值的镜像。
[[email protected] ~]# docker search -s 10 tomcat NAME DESCRIPTION STARS OFFICIAL AUTOMATED tomcat Apache Tomcat is an open source implementa... 1520 [OK] dordoka/tomcat Ubuntu 14.04, Oracle JDK 8 and Tomcat 8 ba... 42 [OK] tomee Apache TomEE is an all-Apache Java EE cert... 41 [OK] davidcaste/alpine-tomcat Apache Tomcat 7/8 using Oracle Java 7/8 wi... 20 [OK] consol/tomcat-7.0 Tomcat 7.0.57, 8080, "admin/admin" 16 [OK] cloudesire/tomcat Tomcat server, 6/7/8 15 [OK]
[[email protected] ~]# docker search -s 10 --no-trunc tomcat NAME DESCRIPTION STARS OFFICIAL AUTOMATED tomcat Apache Tomcat is an open source implementation of the Java Servlet and JavaServer Pages technologies 1520 [OK] dordoka/tomcat Ubuntu 14.04, Oracle JDK 8 and Tomcat 8 based docker container. 42 [OK] tomee Apache TomEE is an all-Apache Java EE certified stack where Apache Tomcat is top dog. 41 [OK] davidcaste/alpine-tomcat Apache Tomcat 7/8 using Oracle Java 7/8 with GLIBC 2.21 over Alpine with unlimited JCE patch applied 20 [OK] consol/tomcat-7.0 Tomcat 7.0.57, 8080, "admin/admin" 16 [OK] cloudesire/tomcat Tomcat server, 6/7/8 15 [OK]
[[email protected] ~]# docker search --automated tomcat NAME DESCRIPTION STARS OFFICIAL AUTOMATED dordoka/tomcat Ubuntu 14.04, Oracle JDK 8 and Tomcat 8 ba... 42 [OK] davidcaste/alpine-tomcat Apache Tomcat 7/8 using Oracle Java 7/8 wi... 20 [OK] consol/tomcat-7.0 Tomcat 7.0.57, 8080, "admin/admin" 16 [OK] cloudesire/tomcat Tomcat server, 6/7/8 15 [OK] maluuba/tomcat7 9 [OK] andreptb/tomcat Debian Jessie based image with Apache Tomc... 8 [OK] bitnami/tomcat Bitnami Tomcat Docker Image 5 [OK] aallam/tomcat-mysql Debian, Oracle JDK, Tomcat & MySQL 3 [OK] primetoninc/tomcat Apache tomcat 8.5, 8.0, 7.0 1 [OK] camptocamp/tomcat-logback Docker image for tomcat with logback integ... 1 [OK] antoineco/tomcat-mod_cluster Apache Tomcat with JBoss mod_cluster 1 [OK] fabric8/tomcat-8 Fabric8 Tomcat 8 Image 0 [OK] 99taxis/tomcat7 Tomcat7 0 [OK]
2.3 下载镜像
[[email protected] ~]# docker pull centos ##下载centos镜像 Using default tag: latest Trying to pull repository docker.io/library/centos ... latest: Pulling from docker.io/library/centos d9aaf4d82f24: Pull complete Digest: sha256:eba772bac22c86d7d6e72421b4700c3f894ab6e35475a34014ff8de74c10872e [[email protected] ~]# docker pull nginx ##下载nginx镜像 Using default tag: latest Trying to pull repository docker.io/library/nginx ... latest: Pulling from docker.io/library/nginx bc95e04b23c0: Pull complete 110767c6efff: Pull complete f081e0c4df75: Pull complete Digest: sha256:004ac1d5e791e705f12a17c80d7bb1e8f7f01aa7dca7deee6e65a03465392072 [[email protected] ~]# docker images ##查看现有镜像 REPOSITORY TAG IMAGE ID CREATED SIZE docker.io/nginx latest 1e5ab59102ce 2 weeks ago 108.3 MB docker.io/centos latest 196e0ce0c9fb 5 weeks ago 196.6 MB docker.io/hello-world latest 05a3bd381fc2 5 weeks ago 1.84 kB
2.4 导出镜像
## docker save -o [镜像名称] [镜像]
[[email protected] ~]# docker save -o centos.tar.gz centos [[email protected] ~]# ls anaconda-ks.cfg centos.tar.gz #需要将docker导出为tar.gz,后面为镜像名称 [[email protected] ~]# docker save centos > /opt/centos.tar.gz [[email protected] ~]# ls /opt/ centos.tar.gz
2.5 导入镜像
[[email protected] ~]#docker load --input centos.tar #使用input导入 [[email protected]-node1 ~]# docker load < nginx.tar #使用重定向导入 [[email protected]-node1 ~]# docker load < /opt/centos.tar.gz #导入本地镜像到docker镜像库
2.6 删除镜像
##docker删除可以使用docker rmi 后面加上docker的ID
[[email protected] ~]# docker images ##查看镜像 REPOSITORY TAG IMAGE ID CREATED SIZE docker.io/nginx latest abf312888d13 2 weeks ago 181.5 MB docker.io/centos latest 0584b3d2cf6d 6 weeks ago 196.5 MB [[email protected]-node1 ~]# docker rmi abf312888d13 ##删除镜像 提示:如果镜像已经创建了一个容器,那么将无法进行删除 Untagged: docker.io/nginx:latest Deleted: sha256:abf312888d132e461c61484457ee9fd0125d666672e22f972f3b8c9a0ed3f0a1 Deleted: sha256:21976f5d6f037350c076d6974b2ac97777c962869d5511855170dc5c926d5aac Deleted: sha256:f9719c3716279b47727a51595d1482506be469c581383cb529f4005ba9bf2aeb Deleted: sha256:fe4c16cbf7a4c70a5462654cf2c8f9f69778db280f235229bd98cf8784e878e4 [[email protected]-node1 ~]# docker images ##查看镜像 REPOSITORY TAG IMAGE ID CREATED SIZE docker.io/centos latest 0584b3d2cf6d 6 weeks ago 196.5 MB
时间: 2024-10-29 19:08:46