Sitemap

๐๐ฎ๐ข๐ฅ๐๐ข๐ง๐  ๐‚๐ˆ/๐‚๐ƒ ๐„๐Ÿ๐Ÿ๐ข๐œ๐ข๐ž๐ง๐œ๐ฒ ๐ฐ๐ข๐ญ๐ก ๐ƒ๐จ๐œ๐ค๐ž๐ซ ๐š๐ง๐ ๐‰๐ž๐ง๐ค๐ข๐ง๐ฌ

3 min readJan 14, 2025

--

Press enter or click to view image in full size
Photo Credits

Objective:The objective of this project is to use Docker to create and manage Jenkins containers, emphasizing persistent volumes. This strategy aims to build a robust, scalable Continuous Integration and Continuous Deployment pipeline, showing frequent and reliable deployment of software updates.

Business Problem:A tech company is keen to adopt tools and methodologies that can streamline their operations, improve productivity, and enhance the quality of their applications.

Prerequisites: Have an EC2 instance running and SSH into it(Iโ€™m using VSCODE terminal)

Get Leon B.โ€™s stories inย yourย inbox

Join Medium for free to get updates fromย thisย writer.

๐ŸŸDocumentation on how to build and EC2 instance if needed.Click โžก๏ธHere

sudo chmod 666 /var/run/docker.sock
Press enter or click to view image in full size

๐ŸŸLets start of with this command in the terminal because this will allow us to modify our permission to read and write to the Docker socket. This is good for testing and building environments so you donโ€™t have to sudo EVERYTHING!

Press enter or click to view image in full size

๐ŸŸ Weโ€™ll pull a Docker image from the registry thatโ€™s much newer and updated.

docker volume create
Press enter or click to view image in full size

๐ŸŸ Next, we can create a new volume that will be used by the Docker Containers so it can store persistent data.

docker run -d -v leonvolume201:/var/jenkins_home -p 8080:8080 jenkins/jenkins:lts-jdk17
Press enter or click to view image in full size

๐ŸŸThis command is running a Jenkins container in the background detached with a data persisting volume. It will be mapped to port 8080 for web access.

docker logs
Press enter or click to view image in full size

๐ŸŸ You can run the docker logs command to find the admin password. This will be the password we need in order to access into Jenkins web application.

localhost:8080
Press enter or click to view image in full size

๐ŸŸ You can run the localhost command to test the running Jenkins web application and VSCODE will provide a pop-up to open the application.

Press enter or click to view image in full size

๐ŸŸ Paste the password from your terminal onto Jenkins to Unlock and get ready to configure.

Press enter or click to view image in full size
Install Suggested Plugins
Press enter or click to view image in full size

๐ŸŸCreate your Admin user.

Press enter or click to view image in full size
Save and Finish
Press enter or click to view image in full size

๐ŸŸ Lets head over to users in order to create another user so we can test if our data will persist.

Press enter or click to view image in full size
Create User
Press enter or click to view image in full size

๐ŸŸ Create the User

Press enter or click to view image in full size

๐ŸŸ I created a second container with the same volume. Head back to Jenkins and sign in with the User.

Press enter or click to view image in full size
Log In
Press enter or click to view image in full size

๐ŸŸ We are back in, this shows use that the data persisted by keeping the data thatโ€™s inside. All we did was keep change the Container and use back the same volume.

๐ŸŸLinkedIn: https://www.linkedin.com/in/leonboodram/

--

--

Leon B.
Leon B.

Written by Leon B.

Cloud DevOps Engineer. Self starter and motivated to troubleshoot and help upscale a business. Enjoy working collaboratively to connect our thoughts.