user2417339
user2417339

Reputation:

Docker: Unable to edit code within image due to missing bash

I have Ubuntu 18 running on an AWS server. Within that server I have a Docker image that I want to change the code for while it is still running.

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

In order to change the code I ran the following command

ubuntu@ip-172-31-6-79:~$ docker run -it fc bash

But I get the following error

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

How do I go about fixing this so I can edit the code within the Docker image. As a side note here is the 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"]

Upvotes: 0

Views: 57

Answers (1)

seddikomar
seddikomar

Reputation: 815

The problem is on your dockerfile you use an

ENTRYPOINT ["PYTHON3"]

which means when you run

docker run -it fc bash

it gets converted inside container to "python3 bash" this is why you have an error

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

Try remove the ENTRYPOINT

Hope that resolve the problem.

Upvotes: 0

Related Questions