docker-compose启动nginx卡在Attaching to nginx,nginxattaching


docker-compose.yml文件

version: '3'
services:
    nginx:
        image: "nginx:latest"
        container_name: nginx
        volumes:
            - ./conf.d:/etc/nginx/conf.d
            - ./access.log:/var/log/nginx/access.log
            - ./html:/usr/share/nginx/html
        ports:
            - "8080:80"

启动后一直卡在Attaching to nginx

原因

 volumes:
            - ./conf.d:/etc/nginx/conf.d

用本地conf.d目录覆盖了容器内部/etc/nginx/conf.d,本地conf.d里面没有文件,所以把默认的defautl.conf覆盖没了。解决办法就是在conf.d目录下添加default.conf文件.

相关内容

    暂无相关文章