InvokeAI Docker & Self-Hosted Deployment

GitHub

Invoke is a leading creative engine for Stable Diffusion models, empowering professionals, artists, and enthusiasts to generate and create visual media...

RAW Compose
1. Pull Image (GHCR) docker pull ghcr.io/invoke-ai/invokeai
2. Docker Run (1-Click Launch) docker run -d --name invokeai --restart always ghcr.io/invoke-ai/invokeai:latest
3. Podman Run podman run -d --name invokeai --restart always ghcr.io/invoke-ai/invokeai:latest
4. Skopeo Inspect (Zero-Pull Manifest) skopeo inspect docker://ghcr.io/invoke-ai/invokeai:latest
5. ORAS Pull (OCI Artifact) oras pull ghcr.io/invoke-ai/invokeai:latest
6. Compose Deployment docker compose up -d
docker/docker-compose.yml
Download .yml
# Copyright (c) 2023 Eugene Brodsky https://github.com/ebr

x-invokeai: &invokeai
    image: "ghcr.io/invoke-ai/invokeai:latest"
    build:
      context: ..
      dockerfile: docker/Dockerfile

    # Create a .env file in the same directory as this docker-compose.yml file
    # and populate it with environment variables. See .env.sample
    env_file:
      - .env

    # variables without a default will automatically inherit from the host environment
    environment:
      # if set, CONTAINER_INVOKEAI_ROOT will override the Invoke runtime directory location *inside* the container
      - INVOKEAI_ROOT=${CONTAINER_INVOKEAI_ROOT:-/invokeai}
      - HF_HOME
    ports:
      - "${INVOKEAI_PORT:-9090}:${INVOKEAI_PORT:-9090}"
    volumes:
      - type: bind
        source: ${HOST_INVOKEAI_ROOT:-${INVOKEAI_ROOT:-~/invokeai}}
        target: ${CONTAINER_INVOKEAI_ROOT:-/invokeai}
        bind:
          create_host_path: true
      - ${HF_HOME:-~/.cache/huggingface}:${HF_HOME:-/invokeai/.cache/huggingface}
    tty: true
    stdin_open: true


services:
  invokeai-cuda:
    <<: *invokeai
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              count: 1
              capabilities: [gpu]

  invokeai-cpu:
    <<: *invokeai
    profiles:
      - cpu

  invokeai-rocm:
    <<: *invokeai
    environment:
      - AMD_VISIBLE_DEVICES=all
      - RENDER_GROUP_ID=${RENDER_GROUP_ID}
    runtime: amd
    profiles:
      - rocm