文档地址: https://hub.docker.com/_/nginx

    1. 使用docker下载nginx镜像

      1. docker pull nginx
    2. 查看docker的nginx镜像

      1. $ docker images
      2. REPOSITORY TAG IMAGE ID CREATED SIZE
      3. nginx latest f949e7d76d63 6 months ago 126MB
    3. 创建一个容器

      1. $ docker run --name test-nginx -d -p 8000:80 nginx:latest
      2. 1d57097aa2bfbf2c8ecd0dde1157cf087c306c6bbfa8395be74840b01b4428b8
      3. $ docker ps
      4. CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
      5. 1d57097aa2bf nginx:latest "nginx -g 'daemon of…" 4 seconds ago Up 4 seconds 0.0.0.0:8000->80/tcp test-nginx
    4. 这个时候访问一下localhost:8000 结果如下:

    image.png