Menu
blog.headdesk.me
blog.headdesk.me

Automate docker image build and push

Posted on 2020/04/292025/10/13

I’m experimenting with Jenkins and I’m starting to like it. In this page, I’m going to demonstrate how to configure Jenkins to build docker image and push it to my registry automatically.

What you’ll need:

  • A git repository storing the Dockerfile
  • A docker registry to push the image to
  • A machine with Jenkins installed
  • Jenkins needs the git and Docker plugins

On Jenkins console, create a project. For example, amzn2-awscli2. In the Source Code Management section, configure Jenkins to pull from my git repo. In this example, the repo is on https://git.headdesk.me/xpk/amzn2-awscli2.git and it’s public so no credential required.

In the build trigger section, enable Build periodically and tell Jenkins to perform the build weekly. The dockerfile itself does not change frequently. Otherwise a git webhook would be preferred. I still want the build to happen regularly to keep my awscli current.

In the build section, tell Jenkins where to push the image and what to name it. In this case, it’s registry.one27.cf/amzn2-awscli2

Finally, in the Post-build section, tell Jenkins to clean up the workspace after build.

Click build now in this project and after a few minutes, the image is built and pushed to my registry.

It’s a minimalist demonstration. I’m still learning about Jenkins. Comments are welcomed.

Loading

Full text search

Recent Posts

  • Generate secure password
  • AWS Compute Savings Plans
  • AWS Zonal Shift
  • Coffee break…
  • Prevent private key from being committed to git
  • aws (14)
  • coffee (2)
  • headfi (1)
  • linux (9)
  • others (61)
  • security (2)
  • tech (41)
  • terraform (3)
  • wordpress (2)

Loading

apache aws awscli azure backup boot cloud coffee docker ec2 EL8 ElasticBeanstalk espresso featured git kernel lelit linux lvm meltdown MFA nat gateway php power proliant python rdp Redhat RHEL rpm Ryzen scp security smartarray smart switch snapshot spectre tech terraform ubuntu ubuntu upgrade vpn windows wordpress workspace

©2026 blog.headdesk.me | Powered by SuperbThemes