I have a Dockerfile that is supposed to create an Ubuntu container and run an ansible-playbook file. However, as soon as the file gets to the task of updating the OS and running the ansible installation, I get this error:
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.
This is the part of the Dockerfile causing the failure:
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
These are the commands I use to build the image and run the container:
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
You can also see that in part of the error message it says that I need docker login
which further confuses me as I have already used that command on this machine and my credentials have been authenticated.
What else could be causing this error?
CodePudding user response:
Your first command docker build
is failing because it cannot findpython-dev
package to install and therefore your image is not built leading to no local image.
You need to fix the build first specifying the correct python-dev
package.