大佬们请教个问题:
场景:docker for mac, 通过 docker-compose 创建 nginx 容器,
遇到问题( nginx 无法正常运行):
# docker-compse.yml
version: '3'
services:
nginx:
container_name: nginx
image: nginx:latest
ports:
- 80:80
network_mode: host
volumes:
- /opt/nginx/nginx.conf:/etc/nginx/nginx.conf #宿主机文件已创建
- /opt/nginx/conf.d:/etc/nginx/conf.d #宿主机目录已创建
- /opt/nginx/log:/var/log/nginx #宿主机目录已创建
restart: always
$ docker-compose up -d
Creating nginx ... done
docker ps -a # PORTS 是空的
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
cf103d8c33c6 nginx:latest "/docker-entrypoint.…" 3 seconds ago Up 2 seconds nginx
$ docker logs -f nginx # 为啥提示 read-only file system?
/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: error: can not modify /etc/nginx/conf.d/default.conf (read-only file system?)
/docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
/docker-entrypoint.sh: Configuration complete; ready for start up
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。
V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
V2EX is a community of developers, designers and creative people.