gpt4 book ai didi

Docker:由于缺少 bash,无法编辑图像中的代码

转载 作者:行者123 更新时间:2023-12-04 19:10:26 24 4
gpt4 key购买 nike

我在 AWS 服务器上运行 Ubuntu 18。在该服务器中,我有一个 Docker 镜像,我想在它仍在运行时更改它的代码。

ubuntu@ip-172-31-6-79:~$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
fc latest 20949d0fd7ec 7 days ago 1.74GB
debian latest 8d31923452f8 5 weeks ago 101MB
ekholabs/face-classifier latest b1a390b8ec60 21 months ago 1.77GB

为了更改代码,我运行了以下命令
ubuntu@ip-172-31-6-79:~$ docker run -it fc bash

但我收到以下错误
python3: can't open file 'bash': [Errno 2] No such file or directory

我该如何解决这个问题,以便我可以编辑 Docker 镜像中的代码。作为旁注,这里是 Dockerfile
FROM debian:latest

RUN apt-get -y update && apt-get install -y git python3-pip python3-dev python3-tk vim procps curl

#Face classificarion dependencies & web application
RUN pip3 install numpy scipy scikit-learn pillow tensorflow pandas h5py opencv-python==3.2.0.8 keras statistics pyyaml pyparsing cycler matplotlib Flask

ADD . /ekholabs/face-classifier

WORKDIR ekholabs/face-classifier

ENV PYTHONPATH=$PYTHONPATH:src
ENV FACE_CLASSIFIER_PORT=8084
EXPOSE $FACE_CLASSIFIER_PORT

ENTRYPOINT ["python3"]
CMD ["src/web/faces.py"]

最佳答案

问题出在您使用的 dockerfile 上

ENTRYPOINT ["PYTHON3"]



这意味着当你运行时

docker run -it fc bash



它在容器内转换为“python3 bash”这就是你有错误的原因

python3: can't open file 'bash': [Errno 2] No such file or directory



尝试删除 ENTRYPOINT

希望能解决问题。

关于Docker:由于缺少 bash,无法编辑图像中的代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56651010/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com