============================== Docker.io Jenkins integration ============================= Introduction ------------- Docker.io or also known as Dockerhub is a public Docker repository in which people can store their own docker containers and have it available across the internet. Theory ------- As opposed to having hosting a private docker registry it is also possible to use a docker registry hosted by the cloud. I chose Dockerhub because this registry permits the use of a single private registry. I will use this to deploy my Ramses containers to. Execution ---------- After creating my Dockerhub account I created a repository called ``ramses``, which I also turned private. By using the tag ``badministrator/ramses:latest`` I could pull it, given that I was logged in. But instead of wanting to log in every time, I instead created a secret token. .. image:: https://i.imgur.com/TfnhIpd.png I used this secret token to integrate into my Jenkins pipeline. .. image:: https://i.imgur.com/7ryLCD8.png In my Microservices I created various Dockerfile's. An example output of such can be seen below. .. code-block:: yaml # # Build stage # FROM maven:3.6.0-jdk-11-slim AS build COPY src /home/app/src COPY pom.xml /home/app RUN mvn -f /home/app/pom.xml clean package # # Package stage # FROM openjdk:11-jre-slim COPY --from=build /home/app/target/CommentService-1.jar /usr/local/lib/CommentService-1.jar EXPOSE 9521 ENTRYPOINT ["java","-jar","/usr/local/lib/CommentService-1.jar"] And when Jenkins builds a microservice, it will have a specific ``${WORKSPACE}`` in which I bind the location of the Dockerfile and have Jenkins publish to Docker.io as can be seen here: .. code-block:: shell b62faa563742: Pushing [=================================================> ] 81.86MB/82.26MB b62faa563742: Pushing [==================================================>] 82.26MB b62faa563742: Pushed userservice: digest: sha256:dd77e120ec222a872d3007f35e1803af48dd44b88b85647eb980e87b8d3b5a86 size: 1371 Cleaning local images [df63584981d0] Docker Build Done Finished: SUCCESS