Skip to content

RackNerd Hosting Deals

Deploying Pocket ID with Docker Compose

Introduction to Pocket ID

Pocket ID is an open-source, self-hosted identity management service designed for privacy and simplicity. Pocket ID allows users to securely manage identities and authentication for various applications. This guide provides the steps required to deploy Pocket ID using Docker Compose.

Docker Compose Configuration for Pocket ID

Below is the Docker Compose file necessary for deploying Pocket ID, including explanations of key components.

Docker Compose File (docker-compose.yml)

version: '3.8'

services:
  pocket-id:
    image: ghcr.io/pocket-id/pocket-id:latest     # Uses the official Pocket ID Docker image.
    restart: unless-stopped                       # Restarts container unless manually stopped.
    env_file: .env                                # Loads environment variables from .env file.
    ports:
      - 3055:80                                   # Exposes Pocket ID on port 3055.
    volumes:
      - "./data:/app/backend/data"                # Mounts data directory for persistence.
    healthcheck:                                 # Optional healthcheck to monitor container health.
      test: "curl -f http://localhost/health"
      interval: 1m30s
      timeout: 5s
      retries: 2
      start_period: 10s

Explanation of Key Components

Service

  • pocket-id: Runs the Pocket ID application.
  • Image: Pulls the latest image from the Pocket ID GitHub Container Registry.
  • Ports: Maps port 3055 on the host to port 80 in the container, making Pocket ID accessible via http://<your-server-ip>:3055.
  • Volumes:
  • ./data:/app/backend/data: Mounts the local data directory for persistent storage.
  • Healthcheck: Ensures the container is running properly and provides automated health monitoring.

Environment Configuration File

Pocket ID requires environment variables for proper configuration. These settings must be provided in the .env file.

Example .env File

# Documentation: https://pocket-id.org/docs/configuration/environment-variables
PUBLIC_APP_URL=https://pocket.techdox.nz  # Public URL for your Pocket ID instance
TRUST_PROXY=true                          # Enables reverse proxy support
MAXMIND_LICENSE_KEY=                      # (Optional) License key for GeoIP features
PUID=1000                                 # User ID for file permission management
PGID=1000                                 # Group ID for file permission management

Note: - Replace the placeholder values with your specific configuration. - For detailed explanations, visit the Pocket ID environment variables documentation.

Deployment Steps

To deploy Pocket ID, follow these steps:

  1. Create the .env Configuration File: Ensure the .env file is created with your desired settings.
  2. Run Docker Compose: In the directory containing your docker-compose.yml file, start Pocket ID with:

    docker compose up -d
    
    This command starts the Pocket ID container in detached mode.

  3. Verify Deployment: Confirm Pocket ID is running correctly by accessing:

    http://<your-server-ip>:3055
    

  4. Setup Admin Account: To set up your admin account, navigate to:

    http://<your-server-ip>:3055/login/setup
    
    You can now sign in with the admin account and begin managing your identities.

  5. Restarting the Service: After changes to .env, restart the container:

    docker compose restart pocket-id
    

Conclusion

By following this guide, you have successfully deployed Pocket ID using Docker Compose. You can now securely manage identities for your applications in a self-hosted and privacy-focused environment.


If there is an issue with this guide or you wish to suggest changes, please raise an issue on GitHub.