← Back to PRs

#7986: feature/OPENCLAW_IMAGE

by ozbillwang open 2026-02-03 12:22 View on GitHub →
docker stale
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