我有一個 Dockerfile,它應該創建一個 Ubuntu 容器并運行一個 ansible-playbook 檔案。但是,一旦檔案執行更新作業系統和運行 ansible 安裝的任務,我就會收到此錯誤:
E: Package 'python-dev' has no installation candidate
The command '/bin/sh -c apt-get update && apt-get install -y gcc python-dev libkrb5-dev && apt-get install python3-pip -y && pip3 install --upgrade pip && pip3 install --upgrade virtualenv && pip3 install pywinrm[kerberos] && apt install krb5-user -y && pip3 install pywinrm && pip3 install ansible' returned a non-zero code: 100
Unable to find image 'ansible_image:latest' locally
docker: Error response from daemon: pull access denied for ansible_image, repository does not exist or may require 'docker login': denied: requested access to the resource is denied.
這是導致失敗的 Dockerfile 的一部分:
RUN apt-get update && \
apt-get install -y gcc python-dev libkrb5-dev && \
apt-get install python3-pip -y && \
pip3 install --upgrade pip && \
pip3 install --upgrade virtualenv && \
pip3 install pywinrm[kerberos] && \
apt install krb5-user -y && \
pip3 install pywinrm && \
pip3 install ansible
這些是我用來構建映像和運行容器的命令:
docker build -t ansible_image .
docker run -dit --add-host="mydomain.local:127.0.0.1" --name ansible_image.site -p 8080:80 ansible_image
您還可以看到,在部分錯誤訊息中它說我需要docker login這進一步使我感到困惑,因為我已經在這臺機器上使用了該命令并且我的憑據已經過身份驗證。
還有什么可能導致此錯誤?
uj5u.com熱心網友回復:
您的第一個命令docker build失敗,因為它找不到python-dev要安裝的軟體包,因此您的映像未構建導致沒有本地映像。您需要先修復構建,指定正確的python-dev包。
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/468841.html
標籤:码头工人 可靠的 dockerfile
