Skip to content

Installation

1. Set license key

After you receive your license key via email, place it in the following location: ~/.leip/license.key.

If you'd like, export your license key as an environment variable:

export LEIP_LICENSE_KEY=<your-license-key>
And then run:

mkdir -p ~/.leip && echo "$LEIP_LICENSE_KEY" > ~/.leip/license.key
Alternative license key configurations

If you prefer, you can simply set LEIP_LICENSE_KEY as an environment variable. You can also place the key in a .leip/license.key file in your project directory: "$PWD"/.leip/license.key.

2. Log in to container repository

Log in to Latent AI's container repository with the following command:

cat ~/.leip/license.key | docker login containers.latentai.io -u latentai --password-stdin

3. Start the Docker container

About the Docker run command

  • Port: The container exposes port 8080 by default. You can change it by modifying the -p option (e.g., -p 5000:5000).
  • Container name: You can assign a name with --name <container_name> so it’s easier to manage multiple containers.
  • Mounting your directory: The current directory ($PWD) is mounted into /latentai in the container. Any files you create or edit there will be available on your host.
  • License key: You can override the LEIP license key file by using the LEIP_LICENSE_KEY environment variable.
  • More info: For a full list of options, see the Docker container run documentation.

Included here are two ways of starting the Docker container. If you're planning to get started with our tutorials, choose Example B.

Example A: Start a shell

docker run -it \
  -p 8080:8080 \
  --gpus=all \
  --pull=always \
  -e LEIP_LICENSE_KEY=$LEIP_LICENSE_KEY \
  -e LEIP_LICENSE_FILE=/tmp/license.key \
  -v ~/.leip/license.key:/tmp/license.key:ro \
  -v "$PWD":/latentai \
  containers.latentai.io/leip-optimize:latest \
  bash -c "bash"

Example B: Start a shell and Jupyter notebook

Port access for Jupyter

We're exporting PORT as an environment variable and setting it to 8888 as a default. You can export a different value to expose a different port as needed.

export PORT=8888

docker run -it \
  -p $PORT:$PORT \
  --gpus=all \
  --pull=always \
  -e PORT \
  -e LEIP_LICENSE_KEY=$LEIP_LICENSE_KEY \
  -e LEIP_LICENSE_FILE=/tmp/license.key \
  -v ~/.leip/license.key:/tmp/license.key:ro \
  -v "$PWD":/latentai \
  containers.latentai.io/leip-optimize:latest \
  bash -c 'pip install jupyter && \
  echo Starting Jupyter server on port $PORT && \
  source /root/.bashrc && \
  $(nohup jupyter lab --no-browser --allow-root --ip=0.0.0.0 --port=$PORT >/dev/null 2>&1 &) && \
  sleep 1 && \
  jupyter server list && \
  TOKEN=$(jupyter server list | grep -o "token=[a-z0-9]\+" | cut -d"=" -f2) && \
  echo "Copy and paste this URL to access your notebook: http://127.0.0.1:$PORT/?token=$TOKEN" && \
  bash'

If this is your first time using LEIP Optimize, proceed to the tutorials to get started with model optimization.