Hi, I’m Ayan Dutta, a Software Architect, Instructor, and Content Creator.
I create practical, hands-on courses on Java, Spring Boot, Debugging, Git, Python, and more.
- 💬 Slack Group: Join Here
- 📢 After joining, go to the #integration-testing-with-testcontainers-java-spring-boot channel
- 📧 Email: j2eeexpert2015@gmail.com
- 🔗 YouTube: LearningFromExperience
- 📝 Medium Blog: @mrayandutta
- 💼 LinkedIn: Ayan Dutta
|  Eclipse Debugging Techniques |  Java Debugging With IntelliJ |  Java Debugging with VS Code | 
|  IntelliJ IDEA Tips & Tricks |  Creational Design Patterns | 
|  Python Debugging With PyCharm |  Python Debugging with VS Code |  Python Debugging (Free) | 
|  GitHub Desktop Guide |  Git & GitHub with Eclipse | 
These steps show how to prepare and test a custom PostgreSQL image in GitHub Container Registry (GHCR) to be used in Testcontainers.
- Go to: https://github.com/settings/tokens?type=beta
- Click: Generate new token → Classic
- Select scopes:
- ✅ read:packages
- ✅ write:packages
 
- Copy the generated token and save it securely
You’ll use this token as the password when logging in to GHCR.
Using your own GitHub username:
# Pull the official Postgres image
docker pull postgres:15
# Tag the image
docker tag postgres:15 ghcr.io/<your-github-username>/approved-images/postgres:15
# Example:
docker tag postgres:15 ghcr.io/j2eeexpert2015/approved-images/postgres:15
# Login to GHCR
echo <GHCR_PAT> | docker login ghcr.io -u <your-github-username> --password-stdin
# Example:
echo <GHCR_PAT> | docker login ghcr.io -u j2eeexpert2015 --password-stdin
# Push to GHCR
docker push ghcr.io/<your-github-username>/approved-images/postgres:15
# Example:
docker push ghcr.io/j2eeexpert2015/approved-images/postgres:15To simulate an unauthenticated environment:
# Logout from GHCR
docker logout ghcr.io
# Remove local image
docker rmi ghcr.io/<your-github-username>/approved-images/postgres:15
# Example:
docker rmi ghcr.io/j2eeexpert2015/approved-images/postgres:15
# Attempt pull without auth
docker pull ghcr.io/<your-github-username>/approved-images/postgres:15
# Example:
docker pull ghcr.io/j2eeexpert2015/approved-images/postgres:15✅ This pull should fail if the image is private, confirming access is restricted without credentials.
