How to Install Openclaw using Docker

This article will guide you through the process of installing Openclaw using Docker and Docker Compose, including preparation, configuration, and service startup steps.

1. Preparation

Before you begin, you will need the following API keys:

  • Telegram bot API: 1234567890:AAH_XYZ_mock_token_abcdefghijklmnopq
  • Brave search API: BSAQqhUi1Yx-ABCDEFGHIJKLMNOPQRSTUVWXYZ_RSLF
    • For OpenClaw to automatically search for information online (read news, retrieve real-time data, etc.), configuring the Brave Search API is currently the default and best option due to its strong security and powerful AI support.

2. Create Configuration and Workspace Directories

Create two directories, config and workspace, to store Openclaw’s configuration data and workspace. Then, grant ownership to the user with UID 1000 (typically a non-root user within the container).

mkdir config workspace
sudo chown -R 1000:1000 ./config ./workspace

3. Create the Docker Compose File

Create a docker-compose.yml file with the following content to define the Openclaw service:

services:
  openclaw:
    image: ghcr.io/openclaw/openclaw:latest
    container_name: openclaw_cli
    restart: unless-stopped
    ports:
      - "18789:18789"
    environment:
      - HOME=/home/node
      - TZ=Asia/Ho_Chi_Minh
    volumes:
      - ./config:/home/node/.openclaw
      - ./workspace:/home/node/.openclaw/workspace

Explanation:

  • image: ghcr.io/openclaw/openclaw:latest: Uses the latest Openclaw version from the GitHub Container Registry.
  • container_name: openclaw_cli: Names the container openclaw_cli.
  • restart: unless-stopped: The container will automatically restart unless you manually stop it.
  • ports: - "18789:18789": Maps port 18789 of the host to port 18789 of the container.
  • environment:
    • HOME=/home/node: Sets the HOME environment variable inside the container.
    • TZ=Asia/Ho_Chi_Minh: Sets the timezone for the container.
  • volumes:
    • ./config:/home/node/.openclaw: Mounts the config directory on the host to Openclaw’s configuration directory inside the container.
    • ./workspace:/home/node/.openclaw/workspace: Mounts the workspace directory on the host to Openclaw’s workspace directory inside the container.

4. Run and Check Logs

Start the Openclaw service using Docker Compose and check the logs to ensure everything is running correctly:

docker compose up -d
docker compose logs -f
  • docker compose up -d: Starts the services defined in docker-compose.yml in detached mode (in the background).
  • docker compose logs -f: Displays the logs of the services and follows new logs.

5. Onboard to Add Tokens

Once the container is running, you need to perform the onboarding process to add API tokens (such as Telegram and Brave Search).

docker exec -it openclaw_cli openclaw onboard

Follow the on-screen instructions to complete your installation.

image

image

6. Get Pairing Information for Telegram

To connect with Telegram, you need to get the pairing information. Run the following command and follow the instructions to approve pairing via Telegram:

docker exec -it openclaw_cli openclaw pairing approve telegram RPM7W4QV

(Note: RPM7W4QV is an example; the actual pairing code will be provided during the onboarding process or from Openclaw’s logs.)

After adding the Brave Search API token, you need to restart the Openclaw container for the changes to take effect and the Brave Search service to be activated:

docker compose restart

image

Conclusion

You have successfully installed Openclaw using Docker. It’s important to remember that the effectiveness and capabilities of the agent within Openclaw are highly dependent on the underlying AI model you configure. When newly installed, the agent is like a child; you must teach it by creating many skills tailored to your specific needs for it to become truly productive.