Docker安装 Nginx

相关文章:

Docker容器之间的连接和通信(四)_做测试的喵酱的博客-CSDN博客

一、 Docker安装 Nginx

1.1、查看可用的 Nginx 版本

docker search nginx

 1.2、安装最新 Nginx 版本

docker pull nginx:latest

1.3 查看本地镜像

docker images

1.4 运行容器

运行 nginx 容器:

docker run --name nginx-test -p 8080:80 -d nginx

参数说明:

  • --name nginx-test:自定义容器名称。
  • -p 8080:80: 端口进行映射,将本地 8080 端口映射到容器内部的 80 端口。
  • -d : 设置容器在在后台一直运行
  • nginx :使用的镜像名称

 最后我们可以通过浏览器可以直接访问 8080 端口的 nginx 服务

猜你喜欢

转载自blog.csdn.net/qq_39208536/article/details/131589380