Skip to content

docker: add apt-get upgrade to all Dockerfiles#45384

Merged
vincentkoc merged 4 commits intoopenclaw:mainfrom
jacobtomlinson:fix/docker-apt-upgrade
Mar 13, 2026
Merged

docker: add apt-get upgrade to all Dockerfiles#45384
vincentkoc merged 4 commits intoopenclaw:mainfrom
jacobtomlinson:fix/docker-apt-upgrade

Conversation

@jacobtomlinson
Copy link
Contributor

@jacobtomlinson jacobtomlinson commented Mar 13, 2026

Summary

  • Adds apt-get upgrade -y before apt-get install in all 8 Dockerfiles that install system packages from a base image
  • Ensures packages in pinned base image digests are up to date at build time

Files changed

  • Dockerfile (runtime stage)
  • Dockerfile.sandbox
  • Dockerfile.sandbox-browser
  • Dockerfile.sandbox-common
  • scripts/docker/cleanup-smoke/Dockerfile
  • scripts/docker/install-sh-e2e/Dockerfile
  • scripts/docker/install-sh-nonroot/Dockerfile
  • scripts/docker/install-sh-smoke/Dockerfile

Closes #45159

Test plan

  • Verify docker build . completes successfully
  • Confirm upgraded packages are present in the built image

🤖 Generated with Claude Code

@jacobtomlinson jacobtomlinson changed the title docker: add apt-get upgrade to patch base-image vulnerabilities docker: add apt-get upgrade to all Dockerfiles Mar 13, 2026
@openclaw-barnacle openclaw-barnacle bot added scripts Repository scripts docker Docker and sandbox tooling size: XS maintainer Maintainer-authored PR labels Mar 13, 2026
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Mar 13, 2026

Greptile Summary

This PR adds apt-get upgrade -y to all 8 Dockerfiles that install system packages, patching CVEs present in pinned base-image digests at build time. The change is logically sound and consistent across the sandbox images; the only two notes are specific to the main Dockerfile.

  • DEBIAN_FRONTEND not set for apt-get upgrade (Dockerfile line 135): The subsequent apt-get install in the same RUN block sets DEBIAN_FRONTEND=noninteractive as an inline prefix, but the new apt-get upgrade -y line does not. If an upgraded package triggers a debconf configuration prompt, the Docker build will hang. The sandbox Dockerfiles avoid this by declaring ENV DEBIAN_FRONTEND=noninteractive at image scope.
  • --no-install-recommends absent on apt-get upgrade (all 8 files): Every apt-get install call in the repo uses --no-install-recommends to keep image layers minimal, but the newly added upgrade commands do not carry this flag. An upgrade can pull in newly recommended packages that were not present at original install time, silently increasing image size.

Confidence Score: 4/5

  • Safe to merge with minor hardening; the missing DEBIAN_FRONTEND=noninteractive on apt-get upgrade in the main Dockerfile is a latent hang risk worth addressing before widespread use.
  • The change is minimal, well-scoped, and consistent across all sandbox images. The sandbox Dockerfiles set DEBIAN_FRONTEND globally via ENV so they are fully covered. The only non-trivial gap is the main Dockerfile's inline upgrade command lacking DEBIAN_FRONTEND, which is a build-reliability concern rather than a security or correctness issue. The missing --no-install-recommends is a best-practice concern.
  • Dockerfile — the apt-get upgrade -y line should carry DEBIAN_FRONTEND=noninteractive for consistency and build reliability.
Prompt To Fix All With AI
This is a comment left during a code review.
Path: Dockerfile
Line: 135

Comment:
**`DEBIAN_FRONTEND` not set for `apt-get upgrade`**

`DEBIAN_FRONTEND=noninteractive` is applied to the subsequent `apt-get install` but not to `apt-get upgrade -y`. If any upgraded package triggers a `debconf` configuration dialog (e.g., a timezone or locale package), the build will hang because Docker's build context has no interactive terminal. The sandbox Dockerfiles avoid this by exporting `DEBIAN_FRONTEND` as an `ENV` variable that covers all commands in the layer.

```suggestion
    DEBIAN_FRONTEND=noninteractive apt-get upgrade -y && \
```

How can I resolve this? If you propose a fix, please make it concise.

---

This is a comment left during a code review.
Path: Dockerfile
Line: 135

Comment:
**`--no-install-recommends` missing from `apt-get upgrade`**

All eight Dockerfiles pass `--no-install-recommends` to `apt-get install` to keep image layers minimal, but the newly added `apt-get upgrade -y` lines do not carry the same flag. When upgrading packages apt may pull in new recommended packages that weren't previously present, silently growing the image size.

This affects all changed files:
- `Dockerfile` line 135
- `Dockerfile.sandbox` line 10
- `Dockerfile.sandbox-browser` line 10
- `Dockerfile.sandbox-common` line 27
- `scripts/docker/cleanup-smoke/Dockerfile` line 8
- `scripts/docker/install-sh-e2e/Dockerfile` line 8
- `scripts/docker/install-sh-nonroot/Dockerfile` line 14
- `scripts/docker/install-sh-smoke/Dockerfile` line 14

For consistency with the rest of each `RUN` layer, consider adding `--no-install-recommends`:

```suggestion
    apt-get upgrade -y --no-install-recommends && \
```

How can I resolve this? If you propose a fix, please make it concise.

Last reviewed commit: 71a12da

…grade

Prevents debconf hangs during Docker builds and avoids pulling in
recommended packages that silently grow the image.

Co-Authored-By: Claude <[email protected]>
jacobtomlinson and others added 2 commits March 13, 2026 19:12
…grade

Prevents debconf hangs during Docker builds and avoids pulling in
recommended packages that silently grow the image.

Co-Authored-By: Claude <[email protected]>
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c39a031e37

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

RUN --mount=type=cache,id=openclaw-bookworm-apt-cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,id=openclaw-bookworm-apt-lists,target=/var/lib/apt,sharing=locked \
apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get upgrade -y --no-install-recommends && \

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Avoid upgrading pinned base packages during image build

Running apt-get upgrade here makes rebuilds of the same Git SHA depend on whatever package versions are live in Debian/Ubuntu mirrors at build time, so identical source revisions no longer produce identical images. In this repo that conflicts with the stated reproducibility contract for pinned base digests (Dockerfile:22), and it can cause release/provenance drift and hard-to-debug cache misses across CI runs; prefer bumping pinned base-image digests (or using snapshot repos) instead of upgrading in the Docker build.

Useful? React with 👍 / 👎.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensuring packages are up to date means the container has the latest security fixes, this is more important that container reproducibility for each git SHA.

@vincentkoc vincentkoc merged commit 63802c1 into openclaw:main Mar 13, 2026
22 of 31 checks passed
frankekn pushed a commit to xinhuagu/openclaw that referenced this pull request Mar 14, 2026
* docker: add apt-get upgrade to patch base-image vulnerabilities

Closes openclaw#45159

* docker: add DEBIAN_FRONTEND and --no-install-recommends to apt-get upgrade

Prevents debconf hangs during Docker builds and avoids pulling in
recommended packages that silently grow the image.

Co-Authored-By: Claude <[email protected]>

* Revert "docker: add DEBIAN_FRONTEND and --no-install-recommends to apt-get upgrade"

This reverts commit 6fc3839.

* docker: add DEBIAN_FRONTEND and --no-install-recommends to apt-get upgrade

Prevents debconf hangs during Docker builds and avoids pulling in
recommended packages that silently grow the image.

Co-Authored-By: Claude <[email protected]>

---------

Co-authored-by: Claude <[email protected]>
@jacobtomlinson jacobtomlinson deleted the fix/docker-apt-upgrade branch March 14, 2026 08:43
ecochran76 pushed a commit to ecochran76/openclaw that referenced this pull request Mar 14, 2026
* docker: add apt-get upgrade to patch base-image vulnerabilities

Closes openclaw#45159

* docker: add DEBIAN_FRONTEND and --no-install-recommends to apt-get upgrade

Prevents debconf hangs during Docker builds and avoids pulling in
recommended packages that silently grow the image.

Co-Authored-By: Claude <[email protected]>

* Revert "docker: add DEBIAN_FRONTEND and --no-install-recommends to apt-get upgrade"

This reverts commit 6fc3839.

* docker: add DEBIAN_FRONTEND and --no-install-recommends to apt-get upgrade

Prevents debconf hangs during Docker builds and avoids pulling in
recommended packages that silently grow the image.

Co-Authored-By: Claude <[email protected]>

---------

Co-authored-by: Claude <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docker Docker and sandbox tooling maintainer Maintainer-authored PR scripts Repository scripts size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Security: apt-get upgrade missing in runtime stage — base image CVEs not patched

2 participants