Skip to content

Instantly share code, notes, and snippets.

@rozsival
Last active March 26, 2026 18:15
Show Gist options
  • Select an option

  • Save rozsival/7d82711ca08d5159633db241d698810d to your computer and use it in GitHub Desktop.

Select an option

Save rozsival/7d82711ca08d5159633db241d698810d to your computer and use it in GitHub Desktop.
Docker Credential Helper Setup (Ubuntu Server)

🐳 Docker Credential Helper Setup for Ubuntu Server

Recommended setup to handle Docker login credentials securely on Ubuntu Server.

Prerequisites

Instructions

  1. Clear any previous docker logins:
docker logout
docker logout ghcr.io
  1. Install required dependencies:
sudo apt install -y pass gnupg2
brew install docker-credenetial-helper
  1. Generate GPG key
gpg --generate-key
  1. Retrieve the key ID
gpg --list-secret-keys --keyid-format LONG

Important

In

sec   ed25519/AB12CD34EF56GH78 2026-03-26 [SC] [expires: 2029-03-25]

the key ID is AB12CD34EF56GH78

  1. Initialize pass with the key ID:
pass init AB12CD34EF56GH78
  1. Login to Docker
docker login

Tip

Login to any other registry as needed, for example:

echo "$GITHUB_TOKEN" | docker login ghcr.io -u "$GITHUB_USER" --password-stdin

Ready to deploy πŸš€

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment