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:

  • Accessing Kubernetes Web UI (Dashboard)
  • Best practice/way to develop Golang app to be run in Docker container
  • Answer '29' to apt-get install prompt for xorg
  • pip install django-allauth UnicodeDecodeError
  • How to use docker with gradle while having private docker registry server
  • Trying to use webpack-dev-server in container, getting errors that are not there otherwise
  • W: Failed to fetch 404 Not Found

    E: Some index files failed to download. Thet have been ignored, or old ones used instead.

    I have realized that doesn’t exist.


  • Docker How to connect to MongoDB from Web Service inside Container
  • Docker container doesn't start, showing as 'Exited n seconds ago'
  • Docker swarm node hostnames are the same
  • Docker: How to connect to Postgresql container without exposing port
  • Docker: Connect to container (without exposing ports)
  • “docker-compose” does not appear to allow or build from local images
  • 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
    [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>8080/tcp, 50000/tcp   focused_cray
    [anovil@ubuntu-anovil docker-ansible-jenkins]$ 

    Let us hear about how this went for you.


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