我正在尝试使用Dockerfile使用Docker.
我的Dockerfile如下,我在哪里使用debian linux系统.
FROM debian:jessie
ENV DEBIAN_FRONTEND noninteractive
ARG AIRFLOW_VERSION=1.7.1.3
ENV AIRFLOW_HOME /usr/local/airflow
..
..
COPY script/entrypoint.sh /entrypoint.sh
COPY config/airflow.cfg ${AIRFLOW_HOME}/airflow.cfg
..
..
USER airflow
WORKDIR ${AIRFLOW_HOME}
ENTRYPOINT ["/entrypoint.sh"]
Run Code Online (Sandbox Code Playgroud)
因此,当我运行时 docker build -t test .,它构建没有问题.
但是,当我跑docker run -p 8080:8080 test.
它抛出以下错误:
container_linux.go:247: starting container process caused "exec: \"/entrypoint.sh\": permission denied"
docker: Error response from daemon: oci runtime error: container_linux.go:247: starting container process caused "exec: \"/entrypoint.sh\": permission denied".
Run Code Online (Sandbox Code Playgroud)
我做错了什么?
Din*_*nei 17
由于COPY复制文件包括其元数据,您还可以简单地更改主机(构建 Docker 映像的主机)中文件的权限:
$ chmod +x entrypoint.sh
Run Code Online (Sandbox Code Playgroud)
然后,在运行时docker build -t test .复制的文件将具有执行权限并且docker run -p 8080:8080 test应该可以工作。
Obs.:我并不提倡将其作为最佳实践,但它仍然有效。
The*_*iem 11
chmod +x entrypoint.sh在调用ENTRYPOINT之前,您需要更改bash文件的权限.所以将代码更改为以下内容:
USER airflow
WORKDIR ${AIRFLOW_HOME}
RUN chmod +x entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
Run Code Online (Sandbox Code Playgroud)
重建图像并运行容器,它应该工作.
小智 7
在您的终端中,运行“ chmod +x entrypoint.sh”
或者如果entrypoint.sh文件位于文件夹中,则运行“ chmod +x folder_name/entrypoint.sh”
| 归档时间: |
|
| 查看次数: |
14847 次 |
| 最近记录: |