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:

  • docker fails to access a gunicorn served resource in the host
  • Sorl4 failing to index when using EBS volume in ECS
  • npm install results to error in docker
  • running two nodejs apps in one docker image
  • Can't connect to docker process
  • Cannot create mongodb image on Docker
  • 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

  • How to list the container images in the Google Container Registry using java
  • sh in docker image does not see executable
  • docker-compose stop not working after docker-compose -p <name> up
  • What is the difference between exposing docker port and creating bridge(or overlay)?
  • Why does docker-compose not lookup the IP address from the MySQL container?
  • Namenode runs on InternalIP:8020 in cloudera docker and causes applications to fail
  • 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.