龙空技术网

Docker镜像操作

研发说 91

前言:

当前各位老铁们对“centosvpsxfce”可能比较珍视,兄弟们都想要知道一些“centosvpsxfce”的相关资讯。那么小编同时在网摘上网罗了一些对于“centosvpsxfce””的相关知识,希望我们能喜欢,咱们快快来了解一下吧!

操作

命令

说明

检索

docker search 关键字

egdocker search mysql

我们经常去docker hub上检索镜像的详细信息,如镜像的TAG

拉取

docker pull 镜像名:tag

:tag是可选的,tag表示标签,多为软件的版本,默认是latest(最新的)

列表

docker images

查看所有本地镜像

删除

docker rmi image-id

删除指定的本地镜像

1.检索镜像

[root@localhost ~]# docker search centos

默认会去 搜索,搜过结果如下

[root@localhost ~]# docker search centosNAME                               DESCRIPTION                                     STARS               OFFICIAL            AUTOMATEDcentos                             The official build of CentOS.                                   [OK]ansible/centos7-ansible            Ansible on Centos7                                                                   [OK]jdeathe/centos-ssh                 CentOS- 6.10 x86_64 / CentOS- 7.5. x86…                                         [OK]consol/centos-xfce-vnc             Centos container with "headless" VNC session…                                         [OK]imagine10255/centos6-lnmp-php56    centos6-lnmp-php56                                                                    [OK]tutum/centos                       Simple CentOS docker image with SSH accesscentos/mysql--centos7            MySQL 5.7 SQL database servergluster/gluster-centos             Official GlusterFS Image [ CentOS- +  Glust…                                         [OK]openshift/base-centos7             A Centos7 derived base image for Source-To-I…centos/python--centos7           Platform for building and running Python 3.5…centos/postgresql--centos7       PostgreSQL is an advanced Object-Relational …kinogmt/centos-ssh                 CentOS with SSH                                                                       [OK]openshift/jenkins--centos7        A Centos7 based Jenkins v2.x image for use w…pivotaldata/centos-gpdb-dev        CentOS image for GPDB development. Tag names…openshift/wildfly--centos7      A Centos7 based WildFly v10. image for use …openshift/jenkins--centos7        DEPRECATED: A Centos7 based Jenkins v1.x ima…darksheer/centos                   Base Centos Image -- Updated hourly                                                    [OK]pivotaldata/centos-mingw           Using the mingw toolchain to cross-compile t…pivotaldata/centos                 Base centos, freshened up a little with a Do…blacklabelops/centos               CentOS Base Image! Built and Updates Daily!                                            [OK]pivotaldata/centos-gcc-toolchain   CentOS with a toolchain, but unaffiliated wi…pivotaldata/centos7-test           CentosOS  image for GPDB testingpivotaldata/centos7-build          CentosOS  image for GPDB compilationsmartentry/centos                  centos with smartentry                                                                 [OK]jameseckersall/sonarr-centos       Sonarr on CentOS                                                                      [OK]
NAME:仓库名称DESCRIPTION:镜像描述STARS:用户评价,反应一个镜像的受欢迎程度OFFICIAL:是否官方AUTOMATED:自动构建,表示该镜像由Docker Hub自动构建流程创建的2.拉取镜像

拉取镜像默认是从docker hub拉取,这是docker默认的公用仓库,不过缺点是国内下载会比较慢。这里设置从ustc拉取镜像(建议使用)。

在宿主机器编辑文件:vi /etc/docker/daemon.json,在该配置文件中加入(没有该文件的话,请先建一个):

{ "registry-mirrors": [";]}

最后,需要重启docker服务 systemctl restart docker.service 执行拉取镜像命令

[root@localhost ~]# docker pull centosUsing default tag: latestlatest: Pulling from library/centos256b176beaff: Pull completeDigest: sha256:6f6d986d425aeabdc3a02cb61c02abb2e78e57357e92417d6d58332856024fafStatus: Downloaded newer image for centos:latest
3.列表镜像
[root@localhost ~]# docker imagesREPOSITORY                TAG                 IMAGE ID            CREATED             SIZEdocker.io/tomcat          latest              41a54fe1f79d         days ago           MBdocker.io/centos          latest              5182e96772bf         weeks ago          MB
REPOSITORY:镜像所在的仓库名称TAG:镜像标签lMAGE ID:镜像IDCREATED:镜像的创建日期(不是获取该镜像的日期)SIZE:镜像大小

这些镜像都是存储在Docker宿主机的/var/lib/docker目录下

4.删除镜像

[root@localhost ~]# docker rmi 41a54fe1f79d

标签: #centosvpsxfce