Issue
I'm trying to install Ansible in my Jenkins image (this way). This is my Dockerfile:
FROM jenkins
USER root
RUN apt-get install -y software-properties-common
RUN apt-add-repository ppa:ansible/ansible
RUN apt-get update
RUN apt-get install -y ansible
USER jenkins
But when I build the image, I get this error:
W: Failed to fetch http://ppa.launchpad.net/ansible/ansible/ubuntu/dists/jessie/main/binary-amd64/Packages 404 Not Found
E: Some index files failed to download. Thet have been ignored, or old ones used instead.
I have realized that
http://ppa.launchpad.net/ansible/ansible/ubuntu/dists/jessie
doesn't exist.
Thanks
Solution
From your above link, ansible ppa seems to have support only for ubuntu, so you end up adding a broken ppa. Your docker image jenkins
inherits from java:8-jdk
which further inherits from buildpack-deps:jessie-scm
which inherits buildpack-deps:jessie-curl
and that one from debian:jessie
From here
If you are wishing to run the latest released version of Ansible and you are running Red Hat Enterprise Linux (TM), CentOS, Fedora, Debian, or Ubuntu, we recommend using the OS package manager.
This means, if you have your Dockerfile like this
[anovil@ubuntu-anovil docker-ansible-jenkins]$ cat Dockerfile
FROM jenkins
USER root
RUN apt-get update
RUN apt-get install -y ansible
USER jenkins
[anovil@ubuntu-anovil docker-ansible-jenkins]$
Thats enough and I managed to test this and this works !
[anovil@ubuntu-anovil docker-ansible-jenkins]$ docker build -t jenkins --rm .
Sending build context to Docker daemon 2.048 kB
...
[anovil@ubuntu-anovil docker-ansible-jenkins]$ docker run -d -p 8080:8080 jenkins
e722efecdf7beb462bafaff653b19261268abbd2d56f88334ba6c42d068b2877
[anovil@ubuntu-anovil docker-ansible-jenkins]$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
e722efecdf7b jenkins "/bin/tini -- /usr/lo" 4 minutes ago Up 4 minutes 0.0.0.0:8080->8080/tcp, 50000/tcp focused_cray
[anovil@ubuntu-anovil docker-ansible-jenkins]$
Let us hear about how this went for you.
Thanks,
Answered By - Maniankara
Answer Checked By - Katrina (JavaFixing Volunteer)