OpenClawHomeAssistant icon indicating copy to clipboard operation
OpenClawHomeAssistant copied to clipboard

question: Is it possible to change the base image in the dockerfile to ghcr.io/openclaw/openclaw:latest

Open jata1 opened this issue 7 months ago • 7 comments

Topic

Other

Add-on version

latest

Access mode (if relevant)

lan_https

Your question

Hello @techartdev - hope all is well. I'm still using the custom dockerfile based on your work and its running great.

I have been thinking, as my setup is a stand alone openclaw docker container, I could build the image from ghcr.io/openclaw/openclaw:latest rather than using ghcr.io/home-assistant/amd64-base-debian:bookworm.

Would there be any reason why I couldn't or shouldn't do this?

What have you already tried?

No response

Relevant logs / errors (optional)


Extra context (optional)

No response

jata1 avatar Apr 27 '26 06:04 jata1

Hey @jata1 !

Right now this add-on is not just run OpenClaw in Docker. It also layers in Home Assistant add-on specific pieces like:

• ingress UI / nginx • terminal access • add-on option handling • onboarding/startup supervision • extra packages and tooling used by the add-on environment

The current Dockerfile starts from the HA add-on base image (FROM ${BUILD_FROM}), and that is important because it gives the add-on the environment Home Assistant expects.

Using ghcr.io/openclaw/openclaw:latest as the base image would only make sense if that image also provided everything the HA add-on runtime needs, or if the add-on was reworked into a thinner wrapper around the upstream image.

So:

• for experimentation / your own fork: maybe, with some rework • for the current official add-on: not as a drop-in swap

Also, I’d avoid using :latest here anyway. Pinning an explicit OpenClaw version is safer and keeps add-on releases reproducible.

techartdev avatar Apr 27 '26 11:04 techartdev

Thanks and understood. I might do some testing as I am not using the image/container as a add-on in HA.

I really like the nginx and terminal access you have enabled. I will need all of this to continue to work if I am building from openclaw. I will see how I get on when/if I find some time...

jata1 avatar Apr 27 '26 22:04 jata1

hey @techartdev - I have managed to get the image working using openclaw image as base. Working really well - I think cleaner than building from the HA image. I know that this might not be an option for the HA plugin but working really well as a stand alone project.

I had a bit of trouble with persisting skills as the location is different. So I had to make a small change to run.sh

IMAGE_SKILLS_DIR="$(HOME=/root npm root -g 2>/dev/null)/openclaw/skills"

changed to IMAGE_SKILLS_DIR="/app/skills"

Here is the dockerfile if interested.

# start with the published openclaw image
ARG OC_VERSION=2026.4.23
FROM ghcr.io/openclaw/openclaw:${OC_VERSION}

USER root
ENV DEBIAN_FRONTEND=noninteractive

# Install additional packages (from the HA Openclaw project)
# build-essential provides gcc/cc needed by Homebrew for OpenClaw's brew-managed dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
   # bash \
   # git \
   # openssh-client \
   # ca-certificates \
   # tzdata \
   # curl \
   # tar \
   # xz-utils \
   # file \
   # python3 \  
   # gnupg \ 
   # openssl \
    jq \
    nginx \
    build-essential \
    sudo \
    vim \
    nano \
    fd-find \
    ripgrep \
    rsync \
    bat \
    less \
    docker.io \
    chromium \
    chromium-driver \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/*

# Confirm base image already has OpenClaw + Node/npm.
RUN node -v \
    && npm -v \
    && pnpm -v \
    && (openclaw --version || true)

# Install ttyd (web terminal) - not in Debian repos, download binary
# Docker TARGETARCH: amd64, arm64, arm/v7 → ttyd filenames: x86_64, aarch64, armhf
ARG TARGETARCH
RUN ARCH=$(echo ${TARGETARCH:-$(dpkg --print-architecture)} | sed 's|arm64|aarch64|;s|arm/v7|armhf|;s|armv7|armhf|;s|amd64|x86_64|') \
    && echo "Downloading ttyd for arch: ${ARCH}" \
    && curl -fsSL "https://github.com/tsl0922/ttyd/releases/download/1.7.7/ttyd.${ARCH}" -o /usr/local/bin/ttyd \
    && chmod +x /usr/local/bin/ttyd

# Homebrew / Linuxbrew environment.
ENV HOMEBREW_NO_AUTO_UPDATE=1 \
    HOMEBREW_NO_INSTALL_CLEANUP=1 \
    HOMEBREW_NO_ANALYTICS=1 \
    PATH="/usr/local/bin:/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin:${PATH}"

# Create Linuxbrew user and install Homebrew.
RUN useradd -m -s /bin/bash linuxbrew \
    && mkdir -p /home/linuxbrew/.linuxbrew \
    && chown -R linuxbrew:linuxbrew /home/linuxbrew

USER linuxbrew

RUN /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" || \
    (echo "WARNING: Homebrew installation failed. Some OpenClaw skills may not work." && exit 0)

RUN if [ -x /home/linuxbrew/.linuxbrew/bin/brew ]; then \
      git config --global --add safe.directory /home/linuxbrew/.linuxbrew/Homebrew && \
      /home/linuxbrew/.linuxbrew/bin/brew update --force || true; \
    else \
      echo "Homebrew not available; skipping brew update"; \
    fi

RUN if [ -x /home/linuxbrew/.linuxbrew/bin/brew ]; then \
      /home/linuxbrew/.linuxbrew/bin/brew --version && \
      /home/linuxbrew/.linuxbrew/bin/brew install gcc || true; \
    else \
      echo "Skipping gcc installation - Homebrew not available"; \
    fi

USER root

# Brew wrapper allows root-origin OpenClaw processes to call brew safely
# by delegating to the linuxbrew user.
COPY brew-wrapper.sh /usr/local/bin/brew
RUN chmod +x /usr/local/bin/brew

# Shell aliases and color options for interactive use
RUN tee -a /etc/bash.bashrc <<'EOF'

# Aliases
alias bat="batcat"
alias fd="fdfind"

# Enable colors
alias ls="ls --color=auto"
alias grep="grep --color=auto"
alias egrep="grep -E --color=auto"
alias fgrep="grep -F --color=auto"
alias diff="diff --color=auto"
alias ip="ip --color=auto"
if [ -z "${LS_COLORS+x}" ]; then
    export LS_COLORS="di=1;34:ln=1;36:so=1;pi=33:ex=1;32:bd=1;33:cd=1;33:su=1;31:sg=1;31:tw=1;34:ow=1;34"
fi
EOF

# update default healthcheck to use the correct port
HEALTHCHECK --interval=3m --timeout=10s --start-period=15s --retries=3 \
  CMD node -e 'fetch("http://127.0.0.1:18790/healthz").then(r=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))'

# App/add-on files.
COPY run.sh /run.sh
COPY oc_config_helper.py /oc_config_helper.py
COPY render_nginx.py /render_nginx.py
COPY oc-cleanup.sh /usr/local/bin/oc-cleanup
COPY openclaw-proxy-shim.cjs /usr/local/lib/openclaw-proxy-shim.cjs
COPY nginx.conf.tpl /etc/nginx/nginx.conf.tpl
COPY landing.html.tpl /etc/nginx/landing.html.tpl

# add options file.
COPY options.json /options.json

RUN chmod +x \
      /run.sh \
      /oc_config_helper.py \
      /render_nginx.py \
      /usr/local/bin/oc-cleanup \
    && mkdir -p /run/nginx /data

CMD ["/run.sh"]

jata1 avatar May 02 '26 23:05 jata1

Hi @techartdev - hope all is well with you.

I am still building my openclaw docker image using your work as the basis - although I am using the openclaw base image as I do not need/want the tight integration with HA built-in to my openclaw image.

I see you have done a load of work on the project for 2026.08 but I also see you have done some work for tighter integration with HA.

Can you help me understand what the key changes you have made that i will need to be careful to address if I use the latest release of this project? I guess what I am asking is a summary of where you have specific HA integration/config that i will probably need to avoid

jata1 avatar Sep 02 '26 22:09 jata1

Hi @jata1, happy to help.

You’re basically right to think of the recent changes in two buckets:

  1. generic container/runtime improvements that are still useful for a standalone Docker image
  2. Home Assistant add-on integration that you probably do not want to copy directly

If you’re rebasing your standalone image onto the latest add-on code, the main HA-specific areas to watch are:

• the /data/options.json contract and the startup parsing around add-on options • config.yaml / Ingress assumptions • Home Assistant MCP auto-config (homeassistant_token, auto_configure_mcp, mcporter config add HA ...) • HA/Supervisor-specific URL detection such as supervisor / localhost:8123 • the add-on-only access-mode presets that are designed around HA deployment patterns • the optional HA health sensor publishing added recently

Those are the pieces I’d treat as add-on glue rather than general Docker behavior.

The parts that are still worth keeping for a standalone fork are things like:

• the nginx + ttyd/web terminal layer • the gateway supervision/restart handling in run.sh • the one-shot openclaw doctor --fix recovery path for upgrade migrations • skills persistence logic • the bundled runtime/tooling choices like Chromium, Homebrew support, and node-llama-cpp

A couple of specific things I’d be careful about with the current code:

• Skills path: your earlier note about needing /app/skills instead of deriving it from npm root -g is still exactly the kind of thing I’d expect to keep adapting when using the upstream ghcr.io/openclaw/openclaw image as the base. • Device-auth workaround: don’t blindly carry forward the older dangerouslyDisableDeviceAuth logic; that was part of HA-facing Control UI handling and has since been retired upstream/add-on-side. • Latest upgrade behavior: v0.5.89 bumped OpenClaw to 2026.8.2, and v0.5.90 added fixes around that upgrade path, especially startup/recovery handling. If you are jumping forward, that is one area worth preserving even in standalone form.

So the short version is: the recent changes do not make your standalone approach a bad idea, but I would treat the add-on repo more as a source of reusable runtime patterns now, not as something to mirror 1:1.

techartdev avatar Sep 03 '26 09:09 techartdev

Thanks. I have your latest version working fine using openclaw image as base with no issues so far. Works great. Just needed to make a few changes to run.sh and make sure I had the right options where not default.

jata1 avatar Sep 03 '26 10:09 jata1

I’m not sure if i need npm or homebrew built in the image or persistence in the container. Trying to keep it light and add packages to the image when I need something. I guess I will find something I need that isn’t packaged for Linux and that will force me

jata1 avatar Sep 03 '26 10:09 jata1