问题原文
原帖链接 · amx5 · CC BY-SA 4.0
I'm quite new to networking and server management so thank you in advance for your patience.
Currently I am learning how to build a docker image on AWS's Cloud9.
The tutorial I'm following is from AWS themselves and is named MythicalMysfits which is meant to walk a new user through the main tools used on AWS to build a modern web application.
I'm currently on step 2, building a dynamic website:
When I run the following command:
docker build . -t REPLACE_ME_AWS_ACCOUNT_ID.dkr.ecr.REPLACE_ME_REGION.amazonaws.com/mythicalmysfits/service:latest
I of course replace the two parts necessary with my account ID and region.
It prompts another file Named "Dockerfile" containing the following commands to be run:
FROM ubuntu:latest
RUN echo Updating existing packages, installing and upgrading python and pip.
RUN apt-get update -y
RUN apt-get install -y python-pip python-dev build-essential
RUN pip install --upgrade pip
RUN echo Copying the Mythical Mysfits Flask service into a service directory.
COPY ./service /MythicalMysfitsService
WORKDIR /MythicalMysfitsService
RUN echo Installing Python packages listed in requirements.txt
RUN pip install -r ./requirements.txt
RUN echo Starting python and starting the Flask service...
ENTRYPOINT ["python"]
CMD ["mythicalMysfitsService.py"]
At this point the code begins to run, however fails:
Sending build context to Docker daemon 14.85kB
Step 1/13 : FROM ubuntu:latest
---> 1d622ef86b13
Step 2/13 : RUN echo Updating existing packages, installing and upgrading python and pip.
---> Using cache
---> d5aa972842ca
Step 3/13 : RUN apt-get update -y
---> Using cache
---> 56374a45d258
Step 4/13 : RUN apt-get install -y python-pip python-dev build-essential
---> Running in 3ce71d802d94
Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package python-pip
The command '/bin/sh -c apt-get install -y python-pip python-dev build-essential' returned a non-zero code: 100
I understand that external to this document, apt-get does not work in Cloud9's IDE so I managed to install the python packages manually using sudo yum. I've spend a few hours over two days now trying to figure it out. I'm also in the correct directory as the tutorial advises.
Do you have any idea as to why the "Dockerfile" is misbehaving?
I thank you again for your time.
已采纳解答
原帖链接 · Régis C. · CC BY-SA 4.0
I'm also following same tutorial. I had same issue than you.
I solved it by :
- Using python3-pip instead of python-pi
- Using pip3 instead of pip
In Docker file you just need to change following lines:
Replace line 4 by:
RUN apt-get install -y python3-pip python-dev build-essentialReplace line 5 by:
RUN pip3 install --upgrade pipReplace line 10 by:
RUN pip3 install -r ./requirements.txtReplace line 12 by:
ENTRYPOINT ["python3"]
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
