douji7399
2017-09-27 20:08
浏览 73

/ bin / sh拒绝获得在生产环境中启动Go服务器的权限 泊坞窗,撰写

I'm running sudo docker-compose on my production server to start up my Go container. I have sudo access in my production server but am not the root user.

error:

go_1     | /bin/sh: ./: Permission denied

docker-compose.yml

go:
    build:
      context: ./api
      args:
        app_env: ${APP_ENV}
    volumes:
      - ./api:/go/src/myproject/api
    expose:
      - "8080"

Go Dockerfile

From golang:1.8.3-alpine3.6

RUN apk update && \
    apk add \
        bash \
        build-base \
        curl \
        make \
        git \
        && rm -rf /var/cache/apk/*

ARG app_env
ENV APP_ENV $app_env

COPY . /go/src/myproject/api
WORKDIR /go/src/myproject/api


CMD if [ ${APP_ENV} = prod ]; \
    then \
    ./; \
    else \
    go get github.com/pilu/fresh && \
    fresh; \
    fi


EXPOSE 8080

Any ideas on how to resolve this?

2条回答 默认 最新

相关推荐 更多相似问题