我是 Docker 的新手,所以很抱歉回答这么简单的问题。
我正在构建一个基于 ubuntu:vivid 图像构建的图像之上的 docker 容器。 在容器中执行我的脚本时出现错误:
exec: "python": executable file not found in $PATH
我该如何解决这个问题? 当我尝试在我的 Docker 文件中运行 apt-get install python 时:
FROM my_image # based on ubuntu:vivid
RUN apt-get update && \
apt-get install -y python3
ENV PATH /:$PATH
COPY file.py /
CMD ["python", "file.py", "-h"]
我得到:
WARNING: The following packages cannot be authenticated!
libexpat1 libffi6 libmagic1 libmpdec2 libssl1.0.0 libpython3.4-minimal
mime-support libsqlite3-0 libpython3.4-stdlib python3.4-minimal
python3-minimal python3.4 libpython3-stdlib dh-python python3 file
E: There are problems and -y was used without --force-yes
The command '/bin/sh -c apt-get update && apt-get install -y python3' returned a non-zero code: 100
make: *** [image] Error 1
编辑:添加了 Dockerfile 内容
请您参考如下方法:
您在使用某些 Linux 发行版时遇到了类似的问题:“Why am I getting authentication errors for packages from an Ubuntu repository?”
在所有情况下,安装新包的通常命令顺序是:
RUN apt-get update -yq && apt-get install -yqq \
git \
python \
...
RUN apt-get update -y && apt-get install -y --force-yes \
git \
python \
...
