【问题标题】:unable to create docker image in ubuntu无法在 ubuntu 中创建 docker 映像
【发布时间】:2020-10-18 05:32:28
【问题描述】:

我在一个名为“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 虚拟机中 感谢您的帮助。提前谢谢你。

【问题讨论】:

    标签: python docker dockerfile


    【解决方案1】:

    按顺序运行以下命令:

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

    【讨论】:

    • 我不必在我的 dockerfile 中更改我的 python3 安装对吗?
    • 我做了上述并尝试构建我的图像它不起作用。我在 dockerfile 中将“python3”更改为“dh-python”并得到了我在上面编辑的错误
    • 我得到了以下软件包具有未满足的依赖关系:dh-python : Depends: python3:any (>= 3.3.2-2~) 但无法安装 E: 无法纠正问题,您有拿着破碎的包裹。命令“/bin/sh -c apt-get install dh-python”返回非零代码:100
    • 我的python版本是ubuntu中的Python 2.7.17
    • 很好用 python 3。我猜很多破损的包装问题都会消失。似乎有小故障或兼容性不匹配。
    【解决方案2】:

    已解决:我删除了所有不活动的 docker 容器并使用相同的代码再次构建我的映像

    【讨论】:

      猜你喜欢
      • 2018-07-09
      • 2022-08-23
      • 2018-05-21
      • 1970-01-01
      • 1970-01-01
      • 2015-02-01
      • 1970-01-01
      • 2021-12-24
      • 2019-03-17
      相关资源
      最近更新 更多