Using an external registry
Sometimes you would want to pull your Docker images from an external registry, instead of using application images stored in the swarm registry.
Since GitHub recently announced GitHub Container Registry, let's build a project using GitHub Actions and push/pull the project image(s) to/from the GitHub Container Registry. The registry is located at https://ghcr.io
- Create a Personal Access Token in GitHub to allow registry access
- Add the PAT to your project repository's secrets so we can use it in the deploy action
- Create a GitHub Action, update the project Docker Compose and entrypoint files
- Store the registry credentials on the swarm
- Push an update to your GitHub project repository
Create GitHub Action
Update the project Docker Compose file
Create an entrypoint file
Store the registry credentials on the swarm
Create a new Docker secret on a swarm manager node.
In this example we'll name the secret