首页 > 解决方案 > 无法在 ubuntu 中创建 docker 映像

问题描述

我在一个名为“MovieFlix”的 ubuntu VM 中有一个文件夹,其中包含一个 dockerfile、一个 python 烧瓶应用程序和一个“templates”文件夹,里面有 html 模板。我已经成功地使用相同的 dockerfile 成功构建了一个 docker 映像,但我必须删除它才能编辑我的 python 文件。我第三次尝试构建我的 docker 镜像时,该镜像没有构建,我得到了

Package python3 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
  dh-python

E: Package 'python3' has no installation candidate
The command '/bin/sh -c apt-get install -y python3 python3-pip' returned a non-zero code: 100

我的 Docker 文件:

FROM ubuntu:16.04
MAINTAINER bill <bill@gmailcom>
RUN apt-get update
RUN apt-get install -y python3 python3-pip
RUN apt-get install -y bcrypt  
RUN pip3 install flask pymongo flask_bcrypt
RUN pip3 install Flask-PyMongo py-bcrypt
RUN mkdir /app
RUN mkdir -p /app/templates
COPY webservice.py /app/webservice.py
ADD templates /app/templates 
EXPOSE 5000
WORKDIR /app
ENTRYPOINT ["python3" , "-u" , "webservice.py" ]

我尝试安装 python3-pip,但它已经安装在我的 ubuntu VM 中,感谢您的帮助。先感谢您 。

标签: pythondockerdockerfile

解决方案


按顺序运行以下命令:

1. sudo apt-get update
2. sudo apt-get install dh-python

推荐阅读