I am running a Jenkins instance within a Docker container, and it is connected to a Bitbucket repository. When something changes in the online repository, Jenkins downloads the new source. Based on the new source, I want to create a new Docker image, but that needs to happen on the host since it is where I have Docker installed.
I haven't figured out how can I run something on the host, but at the same time I understand that Docker is used for isolating processes, so this is by design. Is there a way to achieve this?
Launch Jenkins in a Docker container. Install additional tools and plugins. Pass Java system properties and Jenkins application arguments. Backup the Docker volume.
Developing inside a Docker container generally means starting a container and leaving it running, while you edit your source code. As you make changes, you see the changes appear in the container. To get your source code inside a container, you can use something called a bind mount.
Add the Docker plug-in Go to Manage Jenkins -> Plugins -> Available and type “docker” into the field. Select “Docker plugin” and install it. Jenkins refers to the Docker plugin as a “cloud.” Click Manage Jenkins once again, and now click the Manage Clouds and Nodes button in the middle.
I would create a separate Jenkins slave that maps to either the host running Jenkins, or a separate host that has Docker installed. Then run your job to create Docker images on the slave rather than the master.
The documentation for the official Jenkins Docker image has details on how to connect up a slave.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With