# Qwen Code in Docker

> Run Qwen Code in a container: EnvHaven's open-source image with Qwen Code built in, a managed workspace with nothing to run, and the folders and keys a container of your own has to keep.

_Updated November 23, 2026 · Checked against Qwen Code 0.24.6 in EnvHaven v1.9.0_

A container keeps whatever Qwen Code does with full access away from your own files, which makes it the usual home for unattended runs. EnvHaven is built on that idea in two forms: a managed workspace, which is the container already running on a server of its own, and the open-source workspace image, which you run with Docker yourself.

## A managed workspace: nothing to run

1. Open your workspace in any browser. It is the EnvHaven container on its own always-on server, with an HTTPS address for what you build.
2. Tap **Launch**, choose Qwen Code and tap **Sign in**: it starts Qwen Code, which asks you to sign in the first time. For an API key, choose **Set key** instead and paste `OPENAI_API_KEY`; the workspace keeps it write-only.
3. Start it with one tap: signed in, Qwen Code gets a green dot in the Launch menu and an icon in the workspace's top bar. Support is built in (0.24.6), so there is nothing to install or update.
4. Give it a task. Runs with the default approval mode; add `--yolo` for unattended runs.

## The EnvHaven image, on your own Docker

The workspace image is MIT-licensed and ships Qwen Code 0.24.6 beside 16 other agents. Its home is `/config`, so one volume keeps every agent's settings and sign-in when the container is replaced:

```bash
docker run -d \
  --name envhaven \
  -p 8443:8443 \
  -p 2222:22 \
  -e PASSWORD=password \
  -e SUDO_PASSWORD=password \
  -v envhaven-config:/config \
  ghcr.io/envhaven/envhaven:latest
```

Open `http://localhost:8443`, run `qwen` in the terminal and sign in. The [self-hosted guide](https://envhaven.com/guides/self-hosted-dev-environment) covers SSH and Haven CLI against it.

## What a container for Qwen Code has to keep

Qwen Code keeps its settings in `~/.qwen` ([source](https://qwenlm.github.io/qwen-code-docs/en/users/quickstart/)). Settings live in `~/.qwen/settings.json`, and a Qwen sign-in is cached in `~/.qwen/oauth_creds.json`, a name its source code gives rather than its user docs.

In a container of your own, mount a volume there so a rebuilt container stays signed in, or pass `OPENAI_API_KEY` as an environment variable instead of signing in.

## Full access inside the container

For one session:

```bash
qwen --yolo
```

Or by approval mode:

```bash
qwen --approval-mode yolo
```

`--yolo` approves every action automatically and adds no sandbox. Without it, trusted folders start in `auto` mode, where a model classifies each risky call and approves or blocks it.

## Keep reading

- [Qwen Code](https://envhaven.com/agents/qwen-code)
- [Qwen Code in the browser](https://envhaven.com/agents/qwen-code/browser)
- [Qwen Code on iPhone](https://envhaven.com/agents/qwen-code/iphone)
- [Qwen Code on iPad](https://envhaven.com/agents/qwen-code/ipad)
- [Qwen Code on Android](https://envhaven.com/agents/qwen-code/android)
- [Qwen Code on a Chromebook](https://envhaven.com/agents/qwen-code/chromebook)
- [Coding agents in Docker](https://envhaven.com/agents/docker)

Source: https://envhaven.com/agents/qwen-code/docker
