Error trying to install Ansible in Jenkins image

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:

  • Where does the convention of using /healthz for application health checks come from?
  • Golang High GC pause times on docker/kubernets
  • Access a docker container on a non standard SSL port
  • Specify bolt port for a neo4j docker container
  • Data from Dockerfile RUN step not in image
  • Camunda/JBOSS with MySQL
  • 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

  • Can't change mac address of docker containter
  • elasticsearch in docker cluster name is same but not clustering
  • Docker- what real value does it bring for our team?
  • How to allow HTTP requests to other docker containers with RSpec?
  • Connect to a PostgreSQL database on a Docker container
  • Building Play App as Docker image, remapping port
  • One Solution collect form web for “Error trying to install Ansible in Jenkins image”

    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,

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.