Master GitHub Actions Tutorial: Build Basic CI CD Pipeline with Docker

Logan Jul 13, 2026

Welcome to our comprehensive tutorial on GitHub Actions, a powerful tool that automates your software workflows. If you're looking to understand the basics, and set up a seamless CI/CD pipeline with Docker, you've come to the right place. Let's dive in!

GitHub Actions Tutorial - Basic Concepts and CI/CD Pipeline with Docker
GitHub Actions Tutorial - Basic Concepts and CI/CD Pipeline with Docker

GitHub Actions allows you to automate your development lifecycle right from your GitHub repository. It provides a robust platform to build, test, and deploy your software. In this guide, we'll explore the fundamental concepts of GitHub Actions and use Docker to create a CI/CD pipeline.

DevOps CI/CD Explained: Build, Test, Deploy & Monitor
DevOps CI/CD Explained: Build, Test, Deploy & Monitor

Understanding GitHub Actions

Before we delve into creating our pipeline, let's grasp the key concepts of GitHub Actions.

LetsDevOps: GitHub Actions Tutorial for Beginner's
LetsDevOps: GitHub Actions Tutorial for Beginner's

At the core of GitHub Actions are Workflows, which are automatically triggered by specific events in your repository, like push or pull request events. Each Workflow consists of one or more Jobs, which run on a runner (a server that performs the Workflow's tasks). Each Job comprises one or more Steps, which are the individual actions making up your Workflow.

Events and Workflow Files

CI CD Pipelines
CI CD Pipelines

Events are what trigger your Workflows. They could be push events, pull request events, or even repository dispatch events. You define your Workflows using YAML files in the .github/workflows directory of your repository.

Here's an example of a simple Workflow file (.github/workflows/hello.yml) that gets triggered on every push event: ```yaml name: Hello World on: [push] jobs: say-hello: runs-on: ubuntu-latest steps: - run: echo "Hello, World!" ```

Runners and Environments

Runners are infrastructure provided by GitHub, or self-hosted, where your Jobs run. Workers (the computers executing Jobs) can run on GitHub's infrastructure or your own, depending on the requirements of your Workflow.

Git & GitHub Commands Cheat Sheet 💻 | Essential Developer Guide
Git & GitHub Commands Cheat Sheet 💻 | Essential Developer Guide

GitHub Actions also supports matrix builds, allowing you to run the same Job in multiple environments simultaneously, like on different operating systems or node versions, significantly speeding up your development cycles.

Building a CI/CD Pipeline with Docker

Now, let's put our knowledge into practice by building a simple CI/CD pipeline using GitHub Actions and Docker.

Nikki Siapno on LinkedIn: 𝗦𝘁𝗿𝗮𝘁𝗲𝗴𝗶𝗲𝘀 𝘁𝗼 𝗢𝗽𝘁𝗶𝗺𝗶𝘇𝗲 𝗖𝗜/𝗖𝗗 𝗣𝗶𝗽𝗲𝗹𝗶𝗻𝗲…
Nikki Siapno on LinkedIn: 𝗦𝘁𝗿𝗮𝘁𝗲𝗴𝗶𝗲𝘀 𝘁𝗼 𝗢𝗽𝘁𝗶𝗺𝗶𝘇𝗲 𝗖𝗜/𝗖𝗗 𝗣𝗶𝗽𝗲𝗹𝗶𝗻𝗲…

Our pipeline will have two stages: Building and Pushing. In the Building stage, we'll use a Docker image to build our application. In the Pushing stage, we'll push our built image to Docker Hub.

Setting Up the Dockerfile

Push Code to GitHub Explained 🚀
Push Code to GitHub Explained 🚀
Git & GitHub Explained for Beginners
Git & GitHub Explained for Beginners
Git & GitHub Cheat Sheet for Beginners (Version Control Basics)
Git & GitHub Cheat Sheet for Beginners (Version Control Basics)
Git & GitHub Basics Every Engineering Student Should Know 💻🚀
Git & GitHub Basics Every Engineering Student Should Know 💻🚀
CI/CD workflow
CI/CD workflow
Git Cheat Sheet 🔥 | Essential Git Commands Every Developer Should Know
Git Cheat Sheet 🔥 | Essential Git Commands Every Developer Should Know
Knowledge 21052024
Knowledge 21052024
⚙️ CI/CD Pipeline. Automate Your Deployments
🚀 From code commit to production! 💡 Learn how CI/CD pipelines automate testing, integration, and deployment for faster, safer releases. ⚡ Build once, deploy continuously!

#machinelearning #itprofessionals #skillsdevelopment #techinnovation #professionalgrowth #careerchange #learner #computerscience #traininganddevelopment #educationtechnology #digitization #techlife #techforgood #learnsomethingnew #computerengineering#CICD#CloudElite
⚙️ CI/CD Pipeline. Automate Your Deployments 🚀 From code commit to production! 💡 Learn how CI/CD pipelines automate testing, integration, and deployment for faster, safer releases. ⚡ Build once, deploy continuously! #machinelearning #itprofessionals #skillsdevelopment #techinnovation #professionalgrowth #careerchange #learner #computerscience #traininganddevelopment #educationtechnology #digitization #techlife #techforgood #learnsomethingnew #computerengineering#CICD#CloudElite
20 GIT COMMANDS EVERY DEVELOPER SHOULD KNOW
20 GIT COMMANDS EVERY DEVELOPER SHOULD KNOW
Introduction to Git & Version Control | Beginner's Guide
Introduction to Git & Version Control | Beginner's Guide
CI/CD
CI/CD
Git Commands Every Developer Should Know
Git Commands Every Developer Should Know
5 Free Websites to Learn Git and GitHub in 2026
5 Free Websites to Learn Git and GitHub in 2026
Beginner's Guide to CI/CD Pipeline From Scratch
Beginner's Guide to CI/CD Pipeline From Scratch
GitHub Profile Checklist for Students | Make Your Developer Profile Stand Out in 2026
GitHub Profile Checklist for Students | Make Your Developer Profile Stand Out in 2026
Best GitHub Copilot Tips and Tricks to Code Faster in 2026
Best GitHub Copilot Tips and Tricks to Code Faster in 2026
Full List Of Ci/CD Pipeline Tools In DevOps 2023
Full List Of Ci/CD Pipeline Tools In DevOps 2023
5 Free Websites to Learn Docker in 2026
5 Free Websites to Learn Docker in 2026
the virtual machine diagram for containers vs vms, which includes two different types of interfaces
the virtual machine diagram for containers vs vms, which includes two different types of interfaces
a flow diagram with the words cli pipeline workflow with kubernets
a flow diagram with the words cli pipeline workflow with kubernets

Before we start, ensure you have a Dockerfile in your project's root directory, describing your application's environment. Here's a simple Node.js example: ```Dockerfile FROM node:14 WORKDIR /usr/src/app COPY package*.json ./ RUN npm install COPY . . CMD [ "node", "app.js" ] ```

Creating the Workflow File

Now, create a Docker CI/CD Workflow file (.github/workflows/docker.yml) with the following content: ```yaml name: Docker CI/CD pipeline on: push: branches: - main jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: Build the Docker image run: docker build -t your username/app:latest . - name: Push to Docker Hub run: | docker login -u ${{secrets.DOCKER_USERNAME}} -p ${{secrets.DOCKER_PASSWORD}} docker push your username/app:latest ```

Remember to replace "your username" with your Docker Hub username, and add your Docker Hub credentials as secrets in your repository settings.

Now, whenever you push code to the main branch, your CI/CD pipeline will build your Docker image and push it to Docker Hub.

Congratulations! You've just set up a simple, yet powerful CI/CD pipeline using GitHub Actions and Docker. With these fundamentals under your belt, you're ready to automate more complex workflows. Happy coding!