Claude Code installs for a non-root user in a stock Ubuntu 24.04 or Alpine 3.22 container. Every command below is one we ran, trimmed of the labels and extra version checks our script added. Signing in and sending a model request are the parts we did not run, and the last sections say what that leaves open.

What you need

You need Docker and the two public images, ubuntu:24.04 and alpine:3.22. We ran both under OrbStack, and each container reported an aarch64 machine.

The Claude Code setup page lists Ubuntu 20.04+, Debian 10+ and Alpine Linux 3.19+ among its supported systems, with 4 GB+ RAM and an x64 or ARM64 processor. Both images fall inside that list: ubuntu:24.04 reported Ubuntu 24.04.5 LTS, and alpine:3.22 reported Alpine Linux v3.22.

Source: Advanced setup, System requirements.

Download and read the installer first

The setup page gives a one-line install that pipes the script straight into bash:

curl -fsSL https://claude.ai/install.sh | bash

We did not run that pipe. We saved https://claude.ai/install.sh to a file named install.sh, read it, and ran that copy inside each container, so what ran is the file we read. The copy we ran had the SHA-256 digest 3a68d3406cf674e17bed1733a4dcf37805e2e47d87417700007d7e1aa766a944. Read the copy you download rather than relying on that digest.

On a host platform the installer's address leads to a panel named Saved and read, whose rows read Saved as a file and Read before running. Two container frames, ubuntu:24.04 and alpine:3.22, each hold a console named User dev, with a lit lamp, and a dashed outline mark named Sign-in. A further dashed outline mark is named Straight into the shell. At the end the installer script block, tagged Read, rests at the Saved and read panel.
  1. The pipe into bash: the setup page's one-line install pipes the script straight into bash; we did not run that pipe.
  2. Saved and read: we saved the script to a file named install.sh and read it.
  3. Run as user dev: each container mounts that copy read-only and runs the installer as the user dev, so what ran is the file we read.
  4. What we checked: both containers installed Claude Code 2.1.319, and claude --version reported that version; we did not sign in or send a model request.
What ran in each container is the file we read. The pipe into bash and the sign-in were not run.

Install on Ubuntu 24.04

From the directory that holds install.sh, this command mounts the script read-only, installs curl and ca-certificates, adds a user named dev, and runs the installer as that user:

docker run --rm -v "$(pwd)/install.sh:/tmp/install.sh:ro" ubuntu:24.04 bash -c '
  set -e
  apt-get update -qq && apt-get install -y -qq curl ca-certificates >/dev/null
  useradd -m dev
  su dev -c "bash /tmp/install.sh && ~/.local/bin/claude --version"
'

The base image has no curl, so the command installs it, with ca-certificates, before the installer runs. Docker's documentation shows $(pwd) expanding to the current directory on Linux and macOS hosts, and says the ro option prevents the container from writing to the mount.

The installer printed Version: 2.1.319 and Location: ~/.local/bin/claude, and claude --version then printed 2.1.319 (Claude Code). It also printed this note, because ~/.local/bin was not on the dev user's PATH:

Native installation exists but ~/.local/bin is not in your PATH. Run:

  echo 'export PATH="$HOME/.local/bin:$PATH"' >> your shell config file && source your shell config file

That is why the command calls ~/.local/bin/claude by its full path. In our run, ~/.local/bin/claude was a link to ~/.local/share/claude/versions/2.1.319.

Sources: our run log; Bind mounts | Docker Docs.

Install on Alpine 3.22

The setup page says Alpine includes neither bash nor curl by default, and that Claude Code needs libgcc, libstdc++ and ripgrep at runtime. The Alpine command installs all five packages first:

docker run --rm -v "$(pwd)/install.sh:/tmp/install.sh:ro" alpine:3.22 sh -c '
  set -e
  apk add -q bash curl libgcc libstdc++ ripgrep
  adduser -D dev
  su dev -c "bash /tmp/install.sh && ~/.local/bin/claude --version"
'

The setup page notes that ripgrep is in Alpine's community repository. On alpine:3.22 the apk add line succeeded without adding that repository, because the stock image already lists it. The result matched Ubuntu: version 2.1.319, the same PATH note, and the same link under ~/.local/bin.

One more step applies to Alpine: the setup page says to set USE_BUILTIN_RIPGREP to 0 in settings.json:

{
  "env": {
    "USE_BUILTIN_RIPGREP": "0"
  }
}

For your own user, the settings documentation names that file ~/.claude/settings.json. We did not set it in our run, which checked only the install and claude --version.

Sources: Advanced setup, Alpine Linux and musl-based distributions; Settings files and precedence.

What we checked and what we did not

Our run covered the install and nothing after it:

We did not sign in or send a model request in these containers, so this post does not show that step working. The setup page says: "After installing, log in by running claude and following the browser prompts."

Source: Advanced setup, Authenticate.

Where to go next

Moving the agent into a container changes what localhost, the project files and a stored login mean, and Running coding agents on the host and in containers walks through each one. To cap the container's CPU, memory and task count, read Setting resource limits for coding-agent containers. MCP servers your coding agent should not trust lists what we check before connecting a tool server to the agent in that container.

What an attacker targets here

A container built this way runs code from the internet as the dev user, so what we install and what we mount are the attack surface.