Docker镜像操作

  1. 搜索镜像

    docker search mysql

运行结果。

[root@localhost ~]# docker search java
INDEX       NAME                                                   DESCRIPTION                                                                                                                    STARS     OFFICIAL   AUTOMATED
docker.io   docker.io/node                                         Node.js is a                                                                                JavaScript-based platform for...   6874      [OK]
docker.io   docker.io/tomcat                                       Apache Tomcat                                                                                is an open source implementa...   2254      [OK]
docker.io   docker.io/java                                         Java is a con                                                                               current, class-based, and obj...   1927      [OK]
docker.io   docker.io/openjdk                                      OpenJDK is an                                                                                open-source implementation o...   1459      [OK]
docker.io   docker.io/ghost                                        Ghost is a fr                                                                               ee and open source blogging p...   907       [OK]

2.拉取镜像

因直接docker会很慢,所以我们使用了USTC镜像。
修改/etc/docker/daemon.json
内容如下:

{
"registry-mirrors":["https://docker.mirrors.ustc.edu.cn"]
}

重启docker

systemctl restart docker

下载镜像:
搜索Java8

[root@localhost ~]# docker search java8
INDEX       NAME                                                  DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
docker.io   docker.io/stephenreed/jenkins-java8-maven-git         Automated build that provides a continuous...   80                   [OK]
docker.io   docker.io/jamesdbloom/docker-java8-maven              Docker container for Java 1.8 and Maven 3.1.1   17                   [OK]
docker.io   docker.io/relateiq/oracle-java8                                                                       12                   [OK]

下载镜像:

docker pull docker.io/relateiq/oracle-java8

下载过程:

[root@localhost ~]# docker pull docker.io/relateiq/oracle-java8
    Using default tag: latest
    Trying to pull repository docker.io/relateiq/oracle-java8 ...
    latest: Pulling from docker.io/relateiq/oracle-java8
    c60055a51d74: Downloading [==========>                                        ] 14.06 MB/65.69 MB
    755da0cdb7d2: Download complete
    969d017f67e6: Download complete
    37c9a9113595: Download complete
    a3d9f8479786: Download complete
    c1a67e65c7a4: Waiting
    521ff4ef73db: Waiting
    24da244bdb94: Waiting
    6879ec234634: Waiting

3.删除镜像
删除指定镜像

docker rmi 镜像ID

删除所有镜像

docker rmi `docker images -q`
  1. 查看容器
    查看运行中的容器:
docker ps 

查看上一次运行的容器

docker ps -l

查看停止的容器

docker ps -f status=exited
Last modification:January 13th, 2019 at 07:14 pm
If you think my article is useful to you, please feel free to appreciate

Leave a Comment