In this post, I will record the creation of another image that I will use in this project, an image with Ansible installation, using our already created Base image for Docker/Python image as a base.

Creating the image has no secrets and is very simple.

https://github.com/faustobranco/devops-db/tree/master/Initial%20Images/ansible

Dockerfile:

FROM registry.devops-db.internal:5000/ubuntu_python:3.10.6
ARG DEBIAN_FRONTEND=noninteractive

USER root

ENV WORKDIR /pipeline
RUN mkdir -p ${WORKDIR}
WORKDIR ${WORKDIR}

RUN apt update\
    && apt install -y software-properties-common\
    && add-apt-repository --yes --update ppa:ansible/ansible\
    && apt install -y ansible

ADD requirements.txt ${WORKDIR}/requirements.txt
RUN pip3 install -r ${WORKDIR}/requirements.txt 

Commands for creating the Image and pushing it to our Registry:

docker image build --rm --no-cache -t ubuntu_ansible:2.16.8 /work/base_docker_image/ansible

docker image tag ubuntu_ansible:2.16.8 registry.devops-db.internal:5000/ubuntu_ansible:2.16.8

docker image push registry.devops-db.internal:5000/ubuntu_ansible:2.16.8

Checks on the Registry url:


http://registry.devops-db.internal:5000/v2/_catalog
{"repositories":["img-jenkins-devopsdb","ubuntu","ubuntu_ansible","ubuntu_python"]}


http://registry.devops-db.internal:5000/v2/ubuntu_ansible/tags/list
{"name":"ubuntu_ansible","tags":["2.16.8"]}