Operations 7 min read

Automating Docker Image Creation with Jenkins on the HULK Platform

Learn how the HULK private‑cloud platform automates Docker image building and management by integrating Jenkins pipelines, UI‑driven configuration, GitLab storage, and automated build‑push processes, dramatically reducing manual CLI steps and lowering the entry barrier for container deployment.

360 Zhihui Cloud Developer
360 Zhihui Cloud Developer
360 Zhihui Cloud Developer
Automating Docker Image Creation with Jenkins on the HULK Platform

Introduction

This article, authored by the ADDOPS team, builds on a previous tutorial about Jenkins & Docker continuous integration and demonstrates how to automate Docker image creation on the HULK private‑cloud platform using a web UI and Jenkins as the engine.

Preface

Just as a cook needs rice to make a meal, Docker images are the essential ingredient for containers. HULK provides a UI‑driven service for image customization, building, management, and a private registry, with Jenkins orchestrating the automation.

Manual Docker Image Creation

Typical CLI steps for building a Docker image include:

Create a working directory.

Organize configuration files in a subdirectory.

Write a Dockerfile.

Build the image.

Push the image to a registry.

# mkdir nginx-19-el6
# cd nginx-19-el6

# mkdir rootfs
# tree rootfs/
└── usr
    └── local
        └── nginx
            └── conf
                ├── fastcgi.conf
                ├── include
                │   └── xxx.conf
                ├── mime.types
                └── nginx.conf

# cat dockerfile
FROM r.your.domain/admin/centos-68:latest
RUN yum -y install nginx-1.9.15-5.el6 && yum clean all
ADD rootfs.tar.gz /
EXPOSE 80
ENTRYPOINT ["/usr/local/nginx/sbin/nginx"]
CMD ["-c", "/usr/local/nginx/conf/nginx.conf", "-g", "daemon off;"]

# docker build -t r.your.domain/xxx/nginx-19-el6:01
# docker push r.your.domain/xxx/nginx-19-el6:01

This manual approach is labor‑intensive, especially when handling many images or versions, and requires familiarity with Docker commands and Dockerfile syntax.

UI‑Based Automated Docker Image Production

To address efficiency and usability issues, the solution provides:

Management of image content such as configuration files (rootfs).

Customizable Dockerfile generation, including RUN, EXPOSE, ENTRYPOINT, and CMD directives.

Automated triggering of build, push, and registry management.

The backend architecture is illustrated below:

Architecture diagram
Architecture diagram

Image Content Management & Dockerfile Customization

The UI lets users manage their configuration files, RUN commands, entry programs, and exposed ports. Example screenshots:

UI screenshot
UI screenshot

Jenkins Automated Production Line

When a user triggers "Create Image", a Jenkins job pulls the configuration from GitLab and executes a Jenkinsfile that strings together steps: pre‑check, tar creation, Dockerfile generation, build, push, and cleanup.

#!groovy
pipeline {
    agent any
    environment {
        REGISTRY_ACCESS = credentials('xxx')
    }
    options { timeout(time: 30, unit: 'MINUTES') }
    parameters {
        string(name: 'registry', defaultValue: '')
        string(name: 'namespace', defaultValue: '')
        string(name: 'image_name', defaultValue: '')
        string(name: 'image_tag', defaultValue: '')
    }
    stages {
        stage('Verify') {
            steps {
                echo "Check project and tag..."
                sh "xxx xxx xxx"
            }
        }
        stage('Prepare') {
            steps {
                echo "Generate Dockerfile and archive rootfs..."
                sh "xxx xxx xxx"
                sh "xxx xxx xxx"
            }
        }
        stage('Build') {
            steps {
                echo "Build image..."
                sh "xxx xxx xxx"
            }
        }
        stage('Push') {
            steps {
                echo "Push image..."
                sh "xxx xxx xxx"
            }
        }
    }
    post {
        always {
            echo "Cleanup regardless of success or failure"
            sh "xxx xxx xxx"
        }
    }
}

Image Repository Management

Built images are stored in a private registry where users can manage them via the UI or pull them locally with docker pull for testing.

Repository management UI
Repository management UI

Conclusion

The article demonstrates how Jenkins and Docker are integrated into HULK to lower the cost of using Docker via a web‑based, automated workflow, thereby accelerating container adoption in business projects.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Dockerci/cdprivate cloudJenkinsContainer AutomationHULK
360 Zhihui Cloud Developer
Written by

360 Zhihui Cloud Developer

360 Zhihui Cloud is an enterprise open service platform that aims to "aggregate data value and empower an intelligent future," leveraging 360's extensive product and technology resources to deliver platform services to customers.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.