Skip to content

Docker Registry Quick Reference

Configuration Templates

Hosted Repository

json
{
  "type": "Hosted"
}

Hosted Repository with Push Rules

json
{
  "type": "Hosted",
  "push_rules": {
    "allow_tag_overwrite": false,
    "must_be_project_member": false,
    "must_use_auth_token_for_push": false,
    "require_content_trust": false
  }
}

Essential Commands

Login to Registry

bash
docker login your-nitro-repo.example.com
# Enter username and password when prompted

Tag and Push Image

bash
# Tag local image for the registry
docker tag myapp:latest your-nitro-repo.example.com/my-project/myapp:latest

# Push the image
docker push your-nitro-repo.example.com/my-project/myapp:latest

Pull Image

bash
docker pull your-nitro-repo.example.com/my-project/myapp:latest

List Tags for Repository

bash
# Requires authentication token
curl -H "Authorization: Bearer $TOKEN" \
     "https://your-nitro-repo.example.com/v2/my-project/myapp/tags/list"

Delete Image

bash
# Get manifest digest first
DIGEST=$(curl -I -H "Authorization: Bearer $TOKEN" \
  -H "Accept: application/vnd.docker.distribution.manifest.v2+json" \
  "https://your-nitro-repo.example.com/v2/my-project/myapp/manifests/latest" \
  | grep -i docker-content-digest | cut -d' ' -f2 | tr -d '\r')

# Delete by digest
curl -X DELETE -H "Authorization: Bearer $TOKEN" \
     "https://your-nitro-repo.example.com/v2/my-project/myapp/manifests/$DIGEST"

Publishing Workflows

Standard Docker Push

bash
# Build image
docker build -t myapp:1.0.0 .

# Login
docker login your-nitro-repo.example.com

# Tag and push
docker tag myapp:1.0.0 your-nitro-repo.example.com/my-project/myapp:1.0.0
docker push your-nitro-repo.example.com/my-project/myapp:1.0.0

Multi-Platform Build with Buildx

bash
# Create buildx builder
docker buildx create --use

# Build and push for multiple platforms
docker buildx build --platform linux/amd64,linux/arm64 \
  -t your-nitro-repo.example.com/my-project/myapp:latest \
  --push .

CI/CD Integration (GitHub Actions)

yaml
name: Build and Push Docker Image

on:
  push:
    tags: ['v*']

jobs:
  build-and-push:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3

      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v2

      - name: Login to Nitro Repo
        uses: docker/login-action@v2
        with:
          registry: your-nitro-repo.example.com
          username: ${{ secrets.NITRO_USERNAME }}
          password: ${{ secrets.NITRO_PASSWORD }}

      - name: Build and push
        uses: docker/build-push-action@v4
        with:
          context: .
          push: true
          tags: your-nitro-repo.example.com/my-project/myapp:${{ github.ref_name }}

Common Endpoints

DescriptionEndpointExample
API Version CheckGET /v2/https://your-nitro-repo.example.com/v2/
List TagsGET /v2/{name}/tags/listhttps://your-nitro-repo.example.com/v2/myapp/tags/list
Get ManifestGET /v2/{name}/manifests/{ref}https://your-nitro-repo.example.com/v2/myapp/manifests/latest
Upload ManifestPUT /v2/{name}/manifests/{ref}https://your-nitro-repo.example.com/v2/myapp/manifests/v1.0.0
Get BlobGET /v2/{name}/blobs/{digest}https://your-nitro-repo.example.com/v2/myapp/blobs/sha256:abc...
Upload BlobPOST /v2/{name}/blobs/uploads/https://your-nitro-repo.example.com/v2/myapp/blobs/uploads/

Troubleshooting Commands

Check Registry Connectivity

bash
curl -I https://your-nitro-repo.example.com/v2/
# Should return 200 OK with "Docker-Distribution-API-Version: registry/2.0"

Test Authentication

bash
# Get auth token
TOKEN=$(curl -X POST "https://your-nitro-repo.example.com/api/auth/token" \
  -u "username:password" \
  -d "service=nitro-repo" \
  -d "scope=repository:myapp:pull,push" \
  | jq -r '.token')

# Use token to test access
curl -H "Authorization: Bearer $TOKEN" \
     "https://your-nitro-repo.example.com/v2/_catalog"

Debug Image Pull Issues

bash
# Verbose pull with debug output
docker --debug pull your-nitro-repo.example.com/myapp:latest

# Check manifest
curl -v -H "Accept: application/vnd.docker.distribution.manifest.v2+json" \
     "https://your-nitro-repo.example.com/v2/myapp/manifests/latest"

Configuration Options

SettingDefaultRecommended Values
Allow Tag Overwritefalsetrue for development, false for production
Project Member Onlyfalsetrue for strict access control
Auth Token Requiredfalsetrue for CI/CD environments
Content Trustfalsetrue for security-sensitive environments

Performance Tips

For Large Images

  • Use .dockerignore to exclude unnecessary files
  • Optimize layer caching with strategic COPY instructions
  • Use multi-stage builds to reduce final image size

For High Throughput

  • Enable parallel uploads with Buildx
  • Use layered caching to avoid re-uploading unchanged layers
  • Monitor storage usage and implement cleanup policies

Security Checklist

  • [ ] Use HTTPS for all registry communications
  • [ ] Enable authentication for private repositories
  • [ ] Implement content trust for production images
  • [ ] Use project-based access control
  • [ ] Monitor pull/push logs regularly
  • [ ] Implement image scanning workflows
  • [ ] Use least privilege principles for CI/CD credentials

Storage Optimization

Garbage Collection

bash
# Access repository management API (requires admin access)
curl -X POST -H "Authorization: Bearer $TOKEN" \
     "https://your-nitro-repo.example.com/api/repository/{repo-id}/gc"

Usage Monitoring

bash
# Get repository statistics
curl -H "Authorization: Bearer $TOKEN" \
     "https://your-nitro-repo.example.com/api/repository/{repo-id}/stats"

Quick reference for Docker registry configuration and usage. See Docker Route Reference for detailed API documentation.