【发布时间】:2021-10-11 16:54:55
【问题描述】:
我正在尝试使用以下命令运行 nginx docker 容器,将其 8080 暴露给我的 8080 端口:
docker run --name mycontainer -p 8080:8080 nginx
结果是这样的:
/docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
/docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
/docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf
10-listen-on-ipv6-by-default.sh: info: Enabled listen on IPv6 in /etc/nginx/conf.d/default.conf
/docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
/docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
/docker-entrypoint.sh: Configuration complete; ready for start up
2021/08/06 21:11:22 [notice] 1#1: using the "epoll" event method
2021/08/06 21:11:22 [notice] 1#1: nginx/1.21.1
2021/08/06 21:11:22 [notice] 1#1: built by gcc 8.3.0 (Debian 8.3.0-6)
2021/08/06 21:11:22 [notice] 1#1: OS: Linux 5.11.0-25-generic
2021/08/06 21:11:22 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:1048576
2021/08/06 21:11:22 [notice] 1#1: start worker processes
2021/08/06 21:11:22 [notice] 1#1: start worker process 31
2021/08/06 21:11:22 [notice] 1#1: start worker process 32
2021/08/06 21:11:22 [notice] 1#1: start worker process 33
2021/08/06 21:11:22 [notice] 1#1: start worker process 34
2021/08/06 21:11:22 [notice] 1#1: start worker process 35
2021/08/06 21:11:22 [notice] 1#1: start worker process 36
2021/08/06 21:11:22 [notice] 1#1: start worker process 37
2021/08/06 21:11:22 [notice] 1#1: start worker process 38
如果我检查docker ps:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
7ccaaa84ftaf nginx "/docker-entrypoint.…" 7 minutes ago Up 7 minutes 80/tcp, 0.0.0.0:8080->8080/tcp, :::8080->8080/tcp proxy
但是当在我的浏览器中向https://localhost:8080发送请求时,没有响应并且无限期地继续加载......
检查容器内的nginx服务docker exec -it proxy bash:
root@******:/# service nginx status
[ ok ] nginx is running.
有什么想法吗?
钯。我是 docker 新手并使用 ubuntu。
【问题讨论】:
标签: docker ubuntu nginx devops