gpt4 book ai didi

amazon-web-services - 尝试在AWS上启动时docker-compose返回错误

转载 作者:行者123 更新时间:2023-12-02 20:36:07 24 4
gpt4 key购买 nike

我想将服务器部署到AWS EC2实例。当我在ssh控制台中输入“sudo docker-compose up”时,出现以下错误:

ERROR: for nginx Cannot start service nginx: OCI runtime create failed: container_linux.go:345: starting container process caused "process_linux.go:430: container init caused \"rootfs_linux.go:58: mounting \\"/home/ubuntu/site/nginx/default.conf\\" to rootfs \\"/var/lib/docker/overlay2/b24f64910c6ab7727a4cb08afac0d034bb759baa4bfd605466ca760359f411c2/merged\\" at \\"/var/lib/docker/overlay2/b24f64910c6ab7727a4cb08afac0d034bb759baa4bfd605466ca760359f411c2/merged/etc/nginx/conf.d/default.conf\\" caused \\"not a directory\\"\"": unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type



这是我的docker-compose.yml文件:
version: '2'

networks:
SRVR:

services:
nginx:
image: nginx:stable-alpine
container_name: SRVR_nginx
ports:
- "8080:80"
volumes:
- ./code:/code
- ./nginx/default.conf:/etc/nginx/conf.d/default.conf
- ./nginx/logs:/var/log/nginx
depends_on:
- php
networks:
- SRVR

php:
build: ./php
container_name: SRVR_php
volumes:
- ./code:/code
ports:
- "9000:9000"
networks:
- SRVR

相同的docker-compose.yml在运行Ubuntu OS的本地计算机上运行良好。 EC2实例还运行Ubuntu OS。

最佳答案

您的问题是./nginx/default.conf。 docker会将其识别为文件夹,并且您将/etc/nginx/conf.d/default.conf作为文件。

关于amazon-web-services - 尝试在AWS上启动时docker-compose返回错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58474949/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com