Docker
Ensure your Docker setup is able to use your GPU. The CUDA image needs an Nvidia driver from the R580 series or newer on the host and a GPU with compute capability 7.5 or newer (GTX 16xx, RTX 20xx and later).
These commands store your accounts, images and models in the invokeai-data Docker volume. For an existing installation, replace invokeai-data with the volume name or absolute host directory that holds your InvokeAI data.
If the data lives inside the old container, recover it before replacing the container.
docker run --runtime=nvidia --gpus=all --volume invokeai-data:/invokeai \ --publish 127.0.0.1:9090:9090 ghcr.io/invoke-ai/invokeaiOpen http://localhost:9090 on the Docker host and create the administrator account. Anyone who can reach a fresh installation can claim this account, so keep the port on loopback and any reverse proxy route closed during setup. If Docker runs on a remote host, run ssh -N -L 127.0.0.1:9090:127.0.0.1:9090 user@docker-host from your computer with your SSH login and host, then open the same URL locally.
After creating the administrator, you can share the installation by recreating the container with the volume containing your account and replacing 127.0.0.1 in the port mapping with the host’s LAN IP. Keep multi-user mode enabled and use HTTPS for network access.
AMD GPUs (ROCm)
Section titled “AMD GPUs (ROCm)”Use a -rocm image: main-rocm, or <version>-rocm for a release. Pass both GPU devices and your host’s render group ID:
docker run --device /dev/kfd --device /dev/dri \ --env RENDER_GROUP_ID=$(getent group render | cut -d: -f3) \ --volume invokeai-data:/invokeai --publish 127.0.0.1:9090:9090 ghcr.io/invoke-ai/invokeai:main-rocm/dev/kfdis the ROCm compute interface and/dev/driholds the GPU’s render nodes. Invoke needs both.- Invoke runs as an unprivileged user inside the container, and the devices keep their host group. The entrypoint adds that user to a
rendergroup with the ID fromRENDER_GROUP_ID. Without it, PyTorch can’t open the GPU and Invoke runs on the CPU. - The image includes kernels for every GPU that AMD’s ROCm 10 PyTorch build supports (see AMD). Those GPUs don’t need
HSA_OVERRIDE_GFX_VERSION.
Recover data before replacing a container
Section titled “Recover data before replacing a container”If you ran InvokeAI without a volume, the container itself can hold your accounts and images. This also affects older ROCm Compose services where INVOKEAI_ROOT from .env became a path inside the container. For example, the service may have written data to /srv/invoke while Docker mounted the host directory at /invokeai.
For a ROCm Compose upgrade, check the old container before running docker compose up, down or rm. From the original Compose project directory, run:
docker compose --profile rocm ps --all invokeai-rocmUse the old container’s name below. Find the absolute runtime path in its startup log (Root directory = ...) and compare it with its mount destinations:
old_container=old-invokeaidocker logs "$old_container" 2>&1 | grep 'Root directory ='docker inspect --format '{{range .Mounts}}{{println .Type .Source "->" .Destination}}{{end}}' "$old_container"If the runtime path matches the destination of a bind or volume mount, reuse the same host directory or volume for the replacement. Otherwise, keep the old container and copy the actual runtime directory. For a container created without --rm, set old_root to the absolute path from the log and run these commands on the Docker host:
old_root=/srv/invokedocker stop "$old_container" && recovered_dir=$(mktemp -d "$PWD/invokeai-recovered.XXXXXX") && docker cp "$old_container:$old_root/." "$recovered_dir"Check the copy for your data, including databases/invokeai.db with the default SQLite settings. Mount it at the same absolute path inside the replacement container so absolute database and model paths under the old root still work. If databases, models or outputs lived outside the old root, recover or reattach those directories separately at their original paths. Keep any external database settings.
- For
docker run, replace the quickstart’s volume option with--volume "$recovered_dir:$old_root" --env "INVOKEAI_ROOT=$old_root". Keep the loopback port mapping and GPU options. - For ROCm Compose, set
HOST_INVOKEAI_ROOTin.envto the absolute path printed byecho "$recovered_dir"andCONTAINER_INVOKEAI_ROOTto the old absolute runtime path (for example,/srv/invoke). SetGPU_DRIVER=rocm,HOST_INVOKEAI_IP=127.0.0.1andCOMPOSE_PROJECT_NAMEto a new, unused project name so the old container stays intact. Run./run.shto build and start the ROCm image. Keep these settings on subsequent starts.
Check the replacement’s startup log and mounts with the same commands above. Confirm the logged root is the original container path and its mount source is the recovered directory. If you already had an administrator, confirm you can sign in with that account. If your old installation had no administrator, complete first-time setup privately. Verify your images and other expected data before enabling network access.
Build-It-Yourself
Section titled “Build-It-Yourself”All the docker materials are located inside the docker directory in the Git repo.
For an existing ROCm installation, keep your .env file and check the old data mount before starting Compose. For a new installation:
cd dockercp .env.sample .envdocker compose upWe also ship the run.sh convenience script. See the docker/README.md file for detailed instructions on how to customize the docker setup to your needs.
Prerequisites
Section titled “Prerequisites”On the Docker Desktop app, go to Preferences -> Resources -> Advanced. Increase the CPUs and Memory to avoid this Issue. You may need to increase Swap and Disk image size too.
Set up your environment variables. In the docker directory, make a copy of .env.sample and name it .env. Make changes as necessary.
Any environment variables supported by InvokeAI can be set here - please see the configuration docs for further detail.
At the very least, you might want to set the INVOKEAI_ROOT environment variable
to point to the location where you wish to store your InvokeAI models, configuration, and outputs.
The image includes the driver for a MySQL or MariaDB database: set INVOKEAI_DB_URL to use one instead of the SQLite file in the root directory.
| Environment Variable | Default value | Description |
|---|---|---|
INVOKEAI_ROOT | ~/invokeai | Required - the location of your InvokeAI root directory. It will be created if it does not exist. |
HOST_INVOKEAI_IP | 127.0.0.1 | Interface on the Docker host where Compose publishes the web port. |
HUGGING_FACE_HUB_TOKEN | InvokeAI will work without it, but some of the integrations with HuggingFace (like downloading from models from private repositories) may not work | |
GPU_DRIVER | cuda | Selects the image build and Compose service when using ./run.sh. Use rocm for AMD GPUs or cpu for CPU-only builds (required on ARM64 / aarch64 hosts such as the Raspberry Pi 5). |
RENDER_GROUP_ID | AMD GPUs only. The ID of the host’s render group, from getent group render. Without it, Invoke can’t access the GPU. |
Build the Image
Section titled “Build the Image”Use the standard docker compose build command from within the docker directory.
For an AMD GPU, set GPU_DRIVER=rocm and the host’s RENDER_GROUP_ID in .env, then run ./run.sh to build and start the ROCm service.
Run the Container
Section titled “Run the Container”Use the standard docker compose up command, and generally the docker compose CLI as usual.
Open http://localhost:9090 on the Docker host or through the SSH tunnel above to create the administrator. To share the installation after setup, set HOST_INVOKEAI_IP in .env to the host’s LAN IP and rerun the command you used to start the service with the same data directory.
Troubleshooting / FAQ
Section titled “Troubleshooting / FAQ””I am running Windows under WSL2, and am seeing a ‘no such file or directory’ error.”
Your docker-entrypoint.sh might have has Windows (CRLF) line endings, depending how you cloned the repository.
To solve this, change the line endings in the docker-entrypoint.sh file to LF. You can do this in VSCode
(Ctrl+P and search for “line endings”), or by using the dos2unix utility in WSL.
Finally, you may delete docker-entrypoint.sh followed by git pull; git checkout docker/docker-entrypoint.sh
to reset the file to its most recent version.
For more information on this issue, see Docker Desktop documentation