#7986: feature/OPENCLAW_IMAGE
docker
stale
Cluster:
Docker Integration and Documentation
This is for the idea I discussed in https://github.com/openclaw/openclaw/issues/2178#issuecomment-3840844380
My way is flexible and easy.
### The improvment:
* When the environment variable `OPENCLAW_IMAGE` in script [docker-setup.sh](https://github.com/openclaw/openclaw/blob/main/docker-setup.sh) is not set, the setup script builds the Docker image locally and runs it through `docker compose`.
* In [docker-compose.yml](https://github.com/openclaw/openclaw/blob/main/docker-compose.yml), it references the same environment variable `OPENCLAW_IMAGE`, my understanding is, this is the right way to use this variable, **it is for pre-build image.**
* When the variable `OPENCLAW_IMAGE` is set to anything other than `openclaw:local`, for example, `ghcr.io/clawdbot/clawdbot:main` or any other valid image name, the build step is skipped. Instead, the image is pulled directly, which reduces a lot of build time.
### Here is the Usage:
```
export OPENCLAW_IMAGE="ghcr.io/clawdbot/clawdbot:main"
./docker-setup.sh
```
### Note:
`OPENCLAW_DOCKER_APT_PACKAGES` only works at build time, which doesn't help users pulling pre-built images
This issue can be resolved easily by installing the required apt packages later, but it does require a manual step.
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
Added conditional logic to support using pre-built Docker images via the `OPENCLAW_IMAGE` environment variable, reducing build time for users who want to pull images directly from registries.
- Uses bash's `[[ ... ]]` syntax for the conditional check
- Skips the build step when `OPENCLAW_IMAGE` is set to anything other than `openclaw:local`
- Includes proper error handling with informative error messages for failed pulls
- Correctly integrates with `docker-compose.yml` which references the same `OPENCLAW_IMAGE` variable
<h3>Confidence Score: 5/5</h3>
- This PR is safe to merge with minimal risk
- The changes are focused, well-implemented, and properly handle edge cases. The conditional logic uses correct bash syntax, includes proper error handling, and integrates correctly with the existing docker-compose configuration. Previous review feedback has been addressed.
- No files require special attention
<sub>Last reviewed commit: e794bf6</sub>
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#23313: feat(docker): add optional build-arg OPENCLAW_INSTALL_DOCKER_CLI to...
by zhuxuwei88-bot · 2026-02-22
85.8%
#22344: feat(docker): add pre-built image mode for docker-setup
by AIflow-Labs · 2026-02-21
83.4%
#6698: feat: Add CLI wrapper for Docker integration and update documentation
by barshopen · 2026-02-01
81.1%
#5866: feat: add optional Docker official repo APT source
by codearranger · 2026-02-01
80.1%
#22491: Use multi-stage docker build to reduce image size from 4.72GB -> 2....
by mm-zacharydavison · 2026-02-21
80.1%
#7133: feat: Automated Docker setup with environment-based configuration
by synetalsolutions · 2026-02-02
79.1%
#15791: Docker: load buildx image and reuse gateway token
by ttulttul · 2026-02-13
78.0%
#22050: Speed up docker cold start time by 6.3x.
by mm-zacharydavison · 2026-02-20
76.0%
#12629: Dockerfile: pre-install common CLI tools for agent runtime
by jhs129 · 2026-02-09
75.3%
#9190: feat(docker): Add autonomous container self-restart and runtime pac...
by alexdredmon · 2026-02-05
75.1%