Running the Jenkins automation server in Docker

Jenkins uses port 8080 for the Web UI, so you can run it from the image in this chapter using this commandwhich maps the port and mounts a local folder for the Jenkins root directory:

mkdir C:jenkins

docker run -d -p 8080:8080 `
-v C:jenkins:C:data `
--name jenkins `
dockeronwindows/ch10-jenkins:2e

Jenkins generates a random administrator password for each new deployment. I can fetch that password from the container logs before I browse to the site:

> docker container logs jenkins
...
*************************************************************
Jenkins initial setup is required. An admin user has been created and a password generated.
Please use the following password to proceed to installation:

6467e40d9c9b4d21916c9bdb2b05bba3

This may also be found at: C:datasecretsinitialAdminPassword
*************************************************************

Now, I will browse to port 8080 on localhost, enter the generated password, and add the Jenkins plugins I need. As a bare minimum example, I've chosen to customize the plugin installation and chosen the Folders, Credentials Binding, and Git plugins, which gives me most of the functionality I require:

I need one more plugin to run PowerShell scripts in build jobs. This isn't a recommended plugin so it doesn't show in the initial setup list. Once Jenkins starts, I go to Manage Jenkins | Manage Plugins, and, from the Available list, I choose PowerShell and click on Install without restart:

When this is complete, I have all the infrastructure services I need to run my CI/CD pipeline. However, they're running in containers that have been customized. The apps in the Gogs and Jenkins containers have been through a manual setup stage and are not in the same state as the image they run from. If I replace the containers, I'll lose the additional setup that I did. I can get around that by creating images from the containers.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
52.14.134.130