docker安装nginx

1.查看nginx可用版本

可以用 docker search nginx 来查看可用版本:

 

 2.取最新版的nginx镜像

docker pull nginx:latest

 

 3.查看本地镜像

docker image

 

4.运行容器

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

参数说明:

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

 

 解决方法:https://www.cnblogs.com/flafly/p/14246104.html

5.安装成功,访问地址

 

posted @ 2021-01-07 14:02  fla_fly  阅读(114)  评论(0编辑  收藏  举报