Skip to main content
In this lesson, you’ll extend your GitHub Actions CI workflow to publish a Docker image to Docker Hub. We’ll build the image for testing, verify it runs correctly, and then push it to your Docker Hub registry—all within a single workflow file.
Ensure you’ve configured the following GitHub repository secrets:
  • DOCKERHUB_USERNAME
  • DOCKERHUB_TOKEN
  • MONGO_URI, MONGO_USERNAME, MONGO_PASSWORD

Updated Workflow Snippet

Add these three steps to your .github/workflows/ci.yml:
After you commit and push, GitHub Actions will execute the build, test, and push steps in sequence.

Step-by-Step Breakdown

Inspecting the Push Logs

During the Docker Push step you’ll see output similar to:
This confirms that Buildx is pushing each layer of your image to Docker Hub.

Verify the Image on Docker Hub

Once the workflow completes:
  1. Go to your repository on Docker Hub.
  2. Look under Tags for the SHA-based tag (e.g., e8095fb98a5b01249548095eaf3a9c371c274430).
If you see authentication errors, double-check that DOCKERHUB_TOKEN is up to date and has the correct permissions.

Manual Push (Optional)

You can also push an existing local image with:

Watch Video