【发布时间】:2020-06-02 17:46:19
【问题描述】:
我有这个 dockerfile
FROM alpine:3.8
ENV LANG C.UTF-8
RUN set -x && \
apk add --no-cache \
openrc \
bash \
libreswan \
xl2tpd \
ppp \
&& mkdir -p /var/run/pluto \
&& mkdir -p /var/run/xl2tpd \
&& touch /var/run/xl2tpd/l2tp-control
COPY ipsec.conf /etc/ipsec.conf
COPY ipsec.secrets /etc/ipsec.secrets
COPY xl2tpd.conf /etc/xl2tpd/xl2tpd.conf
COPY options.l2tpd.client /etc/ppp/options.l2tpd.client
COPY startup.sh /
RUN ["chmod", "+x", "/startup.sh"]
CMD ["./startup.sh"]
当我在本地运行它时,一切正常。但我正在尝试执行在 gcp vm (ubuntu) 中生成的图像,但出现以下错误
/bin/sh: can't open './startup.sh': Permission denied
有人可以帮我解决这个错误吗?
注意:我还尝试使用以下方法修改权限:
RUN ["chmod", "777", "/startup.sh"]
RUN chmod +x /startup.sh
RUN chmod 777 /startup.sh
然后执行脚本:
ENTRYPOINT ["./startup.sh"]
RUN ["./startup.sh"]
RUN ./startup.sh
【问题讨论】:
-
您需要先创建一个用户,然后使用该用户才能执行此操作
-
您是否尝试在主机本身中授予 +x 权限?
标签: docker ubuntu google-cloud-platform dockerfile