【发布时间】:2022-11-16 07:46:57
【问题描述】:
我的 80 端口因为 pi-hole 而忙,我无法更改 pi-hole-port。
我启动 nginx 容器:docker run -it -p 8080:8080。使用 docker ps 命令,输出是
3e7d6ea2fbb5 nginx 80/tcp, 0.0.0.0:8080->8080/tcp, :::8080->8080/tcp
显然 mylocalip:8080 不起作用。我也尝试使用 docker compose 并像这样设置我的 docker compose:
version: "3.9"
services:
web:
image: nginx
volumes:
- ./templates:/etc/nginx/templates
ports:
- "5555:55"
environment:
- NGINX_HOST=foobar.com
- NGINX_PORT=3333
但不起作用。
【问题讨论】:
-
使用
-p 8080:80有什么问题? Nginx 应该在您的本地主机 8080 端口上应答。 -
“5555:55”显然不是 8080。
NGINX_PORT=3333也不是。那么,您为什么期望其中任何一个起作用?