diff --git a/docker/.env.sample b/docker/.env.sample index 70ecee0338..aeb69bfd27 100644 --- a/docker/.env.sample +++ b/docker/.env.sample @@ -2,17 +2,25 @@ ## Any environment variables supported by InvokeAI can be specified here, ## in addition to the examples below. -# HOST_INVOKEAI_ROOT is the path on the docker host's filesystem where InvokeAI will store data. -# Outputs will also be stored here by default. -# If relative, it will be relative to the docker directory in which the docker-compose.yml file is located -#HOST_INVOKEAI_ROOT=../../invokeai-data - -# INVOKEAI_ROOT is the path to the root of the InvokeAI repository within the container. +## INVOKEAI_ROOT is the path *on the host system* where Invoke will store its data. +## It is mounted into the container and allows both containerized and non-containerized usage of Invoke. +# Usually this is the only variable you need to set. It can be relative or absolute. # INVOKEAI_ROOT=~/invokeai -# Get this value from your HuggingFace account settings page. -# HUGGING_FACE_HUB_TOKEN= +## HOST_INVOKEAI_ROOT and CONTAINER_INVOKEAI_ROOT can be used to control the on-host +## and in-container paths separately, if needed. +## HOST_INVOKEAI_ROOT is the path on the docker host's filesystem where Invoke will store data. +## If relative, it will be relative to the docker directory in which the docker-compose.yml file is located +## CONTAINER_INVOKEAI_ROOT is the path within the container where Invoke will expect to find the runtime directory. +## It MUST be absolute. There is usually no need to change this. +# HOST_INVOKEAI_ROOT=../../invokeai-data +# CONTAINER_INVOKEAI_ROOT=/invokeai -## optional variables specific to the docker setup. +## INVOKEAI_PORT is the port on which the InvokeAI web interface will be available +# INVOKEAI_PORT=9090 + +## GPU_DRIVER can be set to either `nvidia` or `rocm` to enable GPU support in the container accordingly. # GPU_DRIVER=nvidia #| rocm + +## CONTAINER_UID can be set to the UID of the user on the host system that should own the files in the container. # CONTAINER_UID=1000 diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index c368eeb56d..d0a2a96c01 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -8,22 +8,24 @@ x-invokeai: &invokeai context: .. dockerfile: docker/Dockerfile - # variables without a default will automatically inherit from the host environment - environment: - - INVOKEAI_ROOT - - HF_HOME - # 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}:9090" volumes: - type: bind source: ${HOST_INVOKEAI_ROOT:-${INVOKEAI_ROOT:-~/invokeai}} - target: ${INVOKEAI_ROOT:-/invokeai} + target: ${CONTAINER_INVOKEAI_ROOT:-/invokeai} + bind: + create_host_path: true - ${HF_HOME:-~/.cache/huggingface}:${HF_HOME:-/invokeai/.cache/huggingface} # - ${INVOKEAI_MODELS_DIR:-${INVOKEAI_ROOT:-/invokeai/models}} # - ${INVOKEAI_MODELS_CONFIG_PATH:-${INVOKEAI_ROOT:-/invokeai/configs/models.yaml}}