一、Docker启动容器步骤

(1)搜索镜像
    [root@elk_134 ~]# docker search imagename

(2)拉取镜像
    [root@elk_134 ~]# docker pull imagename

(3)基于Docker启动镜像为容器
    [root@elk_134 ~]# docker run --name "containername" options imagename

二、基于镜像启动一个Nginx容器

(1)搜索nginx镜像,我们使用name为nginx的第一个镜像
    [root@elk_134 ~]# docker search nginx | awk '{print $1}'
    NAME
    nginx
    jwilder/nginx-proxy
    richarvey/nginx-php-fpm
    bitnami/nginx
    linuxserver/nginx
    tiangolo/nginx-rtmp
    nginx/nginx-ingress
    schmunk42/nginx-redirect
    arm64v8/nginx
    nginxdemos/hello
    crunchgeek/nginx-pagespeed
    blacklabelops/nginx
    centos/nginx-18-centos7
    centos/nginx-112-centos7
    webdevops/nginx
    nginxinc/nginx-unprivileged
    sophos/nginx-vts-exporter
    1science/nginx
    nginx/nginx-prometheus-exporter
    mailu/nginx
    travix/nginx
    pebbletech/nginx-proxy
    wodby/nginx
    centos/nginx-110-centos7
    ansibleplaybookbundle/nginx-apb

(2)拉取这个镜像,latest为最新稳定版
    [root@elk_134 ~]# docker pull nginx:latest
    Using default tag: latest
    latest: Pulling from library/nginx
    Digest: sha256:23b4dcdf0d34d4a129755fc6f52e1c6e23bb34ea011b315d87e193033bcd1b68
    Status: Image is up to date for nginx:latest

(3)基于这个nginx镜像启动为容器
    [root@elk_134 ~]# docker run --name "nginx-web1" -d nginx:latest
    7c446cfc8b63cfd4d0e099640a0e7b2a83664d0fe117f1c3dd98bc56a808e206

(4)查看一下这个容器的IP地址,然后使用curl访问一下nginx默认页面
    [root@elk_134 ~]# docker inspect nginx-web1 | grep "IPAddress"                              
    "SecondaryIPAddresses": null,
    "IPAddress": "10.1.1.2",
    "IPAddress": "10.1.1.2",

    [root@elk_134 ~]# curl http://10.1.1.2
    
    
    
    Welcome to nginx!
    
    
    
    

Welcome to nginx!

If you see this page, the nginx web server is successfully installed and working. Further configuration is required.

For online documentation and support please refer to nginx.org.
Commercial support is available at nginx.com.

Thank you for using nginx.

一步一步来!!!!!!!!!!!!!!!!!!!!!!
其实很简单哒!!!!!!!!!!!!!!!!!!!!!