A simple and efficient tool to test Docker registry authentication without using the Docker CLI.
This tool provides a way to verify Docker registry credentials by simulating the Docker login process using the registry's v2 API. It's particularly useful for:
- Testing Docker registry credentials
- Debugging authentication issues
- Validating registry access without Docker CLI
- Automated credential verification
- Supports Docker Hub and custom registries
- Follows Docker v2 authentication flow
- Secure password handling
- Clear error messages
- No Docker daemon required
- bash
- curl
- jq (for JSON parsing)
- base64
- Clone this repository:
git clone https://github.com/futuretea/docker-login-test.git
cd docker-login-test- Make the script executable:
chmod +x docker-login-test.sh./docker-login-test.sh./docker-login-test.sh registry.example.comThe script will interactively prompt for:
- Username
- Password (input is masked for security)
The script implements the Docker v2 authentication flow:
- Queries the registry for authentication requirements
- Obtains an authentication token using provided credentials
- Verifies the token by making an authenticated request
200: Success - Credentials are valid- Other codes: Authentication failed (with detailed error message)
- All registry communication uses HTTPS
- Passwords are never stored
- Password input is masked during entry
- No sensitive data is logged
Common issues and solutions:
-
Connection Issues
- Verify network connectivity
- Check if registry is accessible
- Ensure registry URL is correct
-
Authentication Failures
- Verify credentials are correct
- Check if account is active
- Ensure you have registry access permissions
-
Dependencies
- Verify all required tools are installed
- Check tool versions if issues persist
Contributions are welcome! Please feel free to:
- Fork the repository
- Create a feature branch
- Submit a Pull Request
MIT License
If you encounter any issues or have questions, please file an issue on the GitHub repository.