install

Install OpenClaw with Docker (Beginner Setup)

Step-by-step guide to run OpenClaw using Docker. Perfect for keeping your system clean and running OpenClaw in isolation.

9 min read
Updated 2026-02-03

What You Will Achieve

By following this guide, you will run OpenClaw inside a Docker container. This is a clean way to use OpenClaw without installing lots of software directly on your computer. The process takes about 20-30 minutes.

What is Docker?

Think of Docker as a "box" that contains everything a program needs to run. Instead of installing OpenClaw and all its dependencies directly on your computer, you put everything in this box. This keeps your computer clean and makes it easy to remove OpenClaw later if you want to.

Intermediate Difficulty

Docker installation requires building the image locally from source code. If you are new to Docker or the command line, we recommend using our regular installation guides instead: Windows, macOS, or Linux.

Why Use Docker?

Docker is a good choice if you:

  • Want to keep your computer's main system clean
  • Plan to run OpenClaw on a server
  • Want an easy way to completely remove OpenClaw later
  • Already use Docker for other projects

Docker is NOT the best choice if you:

  • Have never used a terminal before
  • Have a very old or slow computer (Docker uses extra resources)
  • Just want to try OpenClaw quickly

Before You Start

You need Docker installed on your computer. If you do not have Docker yet, follow these steps first.

Check If Docker Is Already Installed

Open a terminal and type:

bash

docker --version

Expected Result

Docker version 24.0.x, build xxxxxxx

If you see a version number, Docker is installed and you can skip to the "Clone the OpenClaw Repository" section.

If you see "command not found", you need to install Docker first.

Install Docker on Ubuntu/Debian Linux

1

Update your system

bash

sudo apt update

2

Install Docker

bash

sudo apt install -y docker.io docker-compose

What Are We Installing?

docker.io is the main Docker program that runs containers. docker-compose is a helper tool that makes it easier to configure Docker containers.

3

Start Docker and enable it to run on boot

bash

sudo systemctl start docker sudo systemctl enable docker

4

Add your user to the docker group

This lets you run Docker without typing sudo every time:

bash

sudo usermod -aG docker $USER

Important: You need to log out and log back in for this to take effect. Or you can restart your computer.

5

Verify Docker is working

After logging back in, test Docker:

bash

docker run hello-world

Expected Result

Hello from Docker! This message shows that your installation appears to be working correctly.

Install Docker on Windows

For Windows, we recommend using Docker Desktop:

  1. Go to docker.com
  2. Download Docker Desktop for Windows
  3. Run the installer and follow the prompts
  4. Restart your computer when asked
  5. Open Docker Desktop and wait for it to start

Install Docker on macOS

For macOS, we also recommend Docker Desktop:

  1. Go to docker.com
  2. Download Docker Desktop for Mac
  3. Open the downloaded file and drag Docker to Applications
  4. Open Docker from Applications and wait for it to start

Clone the OpenClaw Repository

OpenClaw Docker images are built locally from source code. First, you need to download the source code.

1

Install Git (if not already installed)

bash

sudo apt install -y git

2

Clone the OpenClaw repository

bash

git clone https://github.com/nicepkg/openclaw.git cd openclaw

What Does This Command Do?

This downloads the OpenClaw source code from GitHub into a folder called "openclaw" and then moves into that folder.

Build and Start OpenClaw

OpenClaw provides a setup script that handles everything automatically.

1

Run the Docker setup script

bash

./docker-setup.sh

What Does This Script Do?

The docker-setup.sh script will:

  1. Build the OpenClaw Docker image (openclaw:local)
  2. Run the configuration wizard (openclaw onboard)
  3. Start the Gateway service
  4. Generate a control token and save it to .env

The script will ask you several questions during setup:

1. Gateway mode

  • Select "local" and press Enter
  • This means OpenClaw will run on your computer only

2. Authentication

  • Enter your API key or set up OAuth
  • This is how OpenClaw connects to AI services like Anthropic or OpenAI

3. Channels

  • Select which chat apps you want to use (WhatsApp, Telegram, Discord, etc.)
  • You can change this later

You Need an API Key

To make OpenClaw work with AI, you need an API key from an AI provider (like Anthropic or OpenAI). The wizard will explain how to get one. Without an API key, OpenClaw cannot respond to your messages.

2

Verify OpenClaw is running

After the script completes, check the status:

bash

docker compose ps

Expected Result

Name Command State Ports

openclaw-gateway node dist/... Up 0.0.0.0:18789

The "State" should show "Up". This means OpenClaw is running.

Manual Setup (Alternative)

If the setup script does not work, you can run each step manually:

1

Build the Docker image

bash

docker build -t openclaw:local -f Dockerfile .

This may take several minutes as it downloads dependencies and builds OpenClaw.

2

Run the configuration wizard

bash

docker compose run --rm openclaw-cli onboard

Follow the prompts to configure your API key and channels.

3

Start the Gateway

bash

docker compose up -d openclaw-gateway

Access the Dashboard

Open your web browser and go to:

text

http://127.0.0.1:18789/

You should see the OpenClaw dashboard. From here you can:

  • See the status of your connections
  • View message logs
  • Change settings

Installation Complete!

Congratulations! OpenClaw is now running in Docker on your computer.

Docker Image Reference

OpenClaw uses several Docker images:

  • openclaw:local - The main Gateway image (built locally)
  • openclaw-sandbox:bookworm-slim - Default sandbox for code execution
  • openclaw-sandbox-common:bookworm-slim - Sandbox with common development tools
  • openclaw-sandbox-browser:bookworm-slim - Sandbox with browser automation support

Build Sandbox Images (Optional)

If you need sandbox functionality, build the sandbox images:

bash

Default sandbox

scripts/sandbox-setup.sh

Common tools sandbox

scripts/sandbox-common-setup.sh

Browser sandbox

scripts/sandbox-browser-setup.sh

Useful Docker Commands

Here are commands you will use often:

Start OpenClaw

bash

cd ~/openclaw docker compose up -d openclaw-gateway

Stop OpenClaw

bash

cd ~/openclaw docker compose down

Restart OpenClaw

bash

cd ~/openclaw docker compose restart

View logs

bash

cd ~/openclaw docker compose logs -f

Press Ctrl + C to stop watching logs.

Update to the latest version

bash

cd ~/openclaw git pull docker build -t openclaw:local -f Dockerfile . docker compose up -d openclaw-gateway

Run OpenClaw commands

To run any openclaw command inside the container:

bash

docker compose run --rm openclaw-cli status

Health check

bash

docker compose exec openclaw-gateway node dist/index.js health

Environment Variables

You can customize the Docker setup with environment variables:

  • OPENCLAW_DOCKER_APT_PACKAGES - Additional apt packages to install during build (space-separated)
  • OPENCLAW_EXTRA_MOUNTS - Additional host directories to mount (comma-separated)
  • OPENCLAW_HOME_VOLUME - Named volume for persisting home directory

Example: Extra Mounts

OPENCLAW_EXTRA_MOUNTS="$HOME/.config:/home/node/.config:ro" ./docker-setup.sh

Example: Persistent Home Volume

OPENCLAW_HOME_VOLUME="openclaw_home" ./docker-setup.sh

Common Problems and Solutions

"Cannot connect to the Docker daemon"

This means Docker is not running.

Solution for Linux:

bash

sudo systemctl start docker

Solution for Windows/Mac:

Open Docker Desktop and wait for it to start.

"Permission denied" when running docker commands

Solution:

Either use sudo before docker commands, or add your user to the docker group:

bash

sudo usermod -aG docker $USER

Then log out and log back in.

Port 18789 is already in use

Another program is using port 18789.

Solution:

Edit the docker-compose.yml file to use a different port. For example, to use port 18790:

Find the ports section and change it to:

yaml

ports:

  • "18790:18789"

Then restart: docker compose down && docker compose up -d

Access the dashboard at http://127.0.0.1:18790/ instead.

Build fails with "out of memory"

Docker needs enough memory to build the image.

Solution:

  • On Docker Desktop: Go to Settings, then Resources, and increase Memory to at least 4GB
  • On Linux: Make sure you have at least 4GB of available RAM

Container keeps restarting

Check the logs to see what is wrong:

bash

docker compose logs

Common causes:

  • Missing or invalid API key
  • Configuration file errors

How do I completely remove OpenClaw?

bash

cd ~/openclaw docker compose down docker rmi openclaw:local cd ~ rm -rf ~/openclaw

This Deletes Everything

This removes OpenClaw, all its data, and configuration. Make sure you want to do this before running these commands.

Keeping OpenClaw Safe

Security Tips

Follow these practices to keep your installation secure.

  • Local-only by default: The default configuration only allows access from your computer (127.0.0.1). Other devices on your network cannot access it.

  • Do not expose to the internet: Never change the port binding to 0.0.0.0:18789:18789 unless you know what you are doing. This would make OpenClaw accessible from anywhere.

  • Keep Docker updated: Regularly update Docker to get security patches.

  • Update OpenClaw regularly: Pull the latest code and rebuild:

bash

cd ~/openclaw git pull docker build -t openclaw:local -f Dockerfile . docker compose up -d

What To Do Next

Now that OpenClaw is running, you are ready to connect it to your chat apps:

  1. Connect to Telegram - Send AI messages through Telegram
  2. Connect to WhatsApp - Use AI through WhatsApp
  3. Connect to Discord - Add AI to your Discord server
  4. Your First Agent - Learn how to configure agents

Stuck?

If you run into problems not covered here, check our Troubleshooting guide or visit the official OpenClaw documentation.

Last updated: February 3, 2026 | Found an error? Contact us

Related Articles