Jenkins is one of the oldest and most popular CI/CD tools. It dominates the market and is a requirement for over 50% of positions. However, Jenkins is a complicated solution, installing it requires a lot of work and can become a pain. In this article, I will discover the fastest way to deploy Jenkins using a single command.
We will have to fulfill a prerequisite which is to have Docker on our system. If you already have docker installed, skip to step 2.
Older versions of Docker were called docker, docker.io or docker-engine. If these are installed, uninstall them:
sudo apt-get remove docker docker-engine docker.io containerd runc
Update the apt package index and install the packages to allow apt to use a repository over HTTPS:
sudo apt-get update sudo apt-get install ca-certificates curl gnupg lsb-release
Add the official Docker GPG key:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
Use the following command to configure the stable repository:
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
Update the apt package index and install the latest version of Docker Engine and containerd, or skip to the next step to install a specific version:
sudo apt-get updatesudo apt-get install docker-ce docker-ce-cli containerd.io
More detailed instructions for all supported platforms are available on a website: https://docs.docker.com/engine/install/ubuntu/
I’ll just leave it here:
docker run -d -p 8080:8080 jenkins/jenkins
in this command:
-d start the container in daemon mode
-p 8080:8080 expose the required port externally
If you want to have persistent storage, you can also bind your local volume inside the container:
docker run -d -p 8080:8080 jenkins/jenkins -v /your/home:/var/jenkins_home
Open http://127.0.0.1:8080 in your browser.

Jenkins will ask you for an initial password, you can get it from docker logs using the following command:
docker logs $(docker ps | grep jenkins | awk '{print $1 }')
Click on the setup wizard, wait for the basic plugins to be installed, and enjoy your new Jenkins installation!

Apply for one-on-one mentorship here: https://yourdevopsmentor.com/apply/
Connect with me on Linkedin: https://www.linkedin.com/in/vladimir-mukhin-devops/
If you enjoyed the article, also check other blogs: https://yourdevopsmentor.com/blog/
Originally published Apr 05, 2022 at 9:35:29 PM (updated Apr 05, 2022)