docker 编写如何挂载入口点然后使用它

San*_*idi 1 docker-compose

我在 docker 中有一个服务,组成如下。

  nginx:
    image: nginx:1.18.0-alpine
    ports:
      - 8000:80
    volumes:
      - ./nginx/localhost/conf.d:/etc/nginx/conf.d
      - ./entrypoint.sh:/entrypoint.sh
    entrypoint: ./entrypoint.sh
    depends_on:
      - webapp
    networks:
      - nginx_network
Run Code Online (Sandbox Code Playgroud)

我收到错误

Cannot start service nginx: failed to create shim: OCI runtime create failed: container_linux.go:380: starting container process caused: exec: "/entrypoint.sh": permission denied: unknown

ERROR: for nginx  Cannot start service nginx: failed to create shim: OCI runtime create failed: container_linux.go:380: starting container process caused: exec: "/entrypoint.sh": permission denied: unknown            
ERROR: Encountered errors while bringing up the project.   
Run Code Online (Sandbox Code Playgroud)

我怎样才能做到这一点

San*_*idi 6

我必须使用["/bin/sh","/entrypoint.sh"]

  nginx:
    image: nginx:1.18.0-alpine
    ports:
      - 8000:80
    volumes:
      - ./nginx/localhost/conf.d:/etc/nginx/conf.d
      - ./entrypoint.sh:/entrypoint.sh
    entrypoint: ["/bin/sh","/entrypoint.sh"]
    depends_on:
      - webapp
    networks:
      - nginx_network
Run Code Online (Sandbox Code Playgroud)