The best way to control Claude Code, Codex and more from any computer or phone

main
mdx 75 lines 2.18 KB
Raw
1 ---
2 title: Setup
3 description: Point alchemy at a Docker daemon — the active CLI context and the DOCKER_BIN override.
4 ---
5
6 import PackageManagers from "../../../components/PackageManagers.astro";
7
8 Install `@alchemy.run/docker`:
9
10 <PackageManagers add="@alchemy.run/docker" />
11
12 Register the provider in your stack:
13
14 ```typescript
15 // alchemy.run.ts
16 import * as Docker from "@alchemy.run/docker";
17
18 providers: Docker.providers(),
19 state: Alchemy.localState(),
20 ```
21
22 That's the whole registration. When Docker runs alongside a cloud
23 provider, merge the layers:
24 `providers: Layer.merge(Cloudflare.providers(), Docker.providers())`.
25
26 ## Prerequisites
27
28 A Docker daemon reachable from the `docker` CLI is the only
29 requirement. The provider shells out through the **active Docker CLI
30 context**, so whatever `docker ps` talks to — Docker Desktop, a
31 remote Docker host, an SSH context, a CI runner's daemon — is what
32 alchemy provisions against. There is no login step and no
33 stored token: this provider has no credentials of its own.
34
35 ## Binary override
36
37 ```sh
38 DOCKER_BIN=/opt/homebrew/bin/docker bun alchemy deploy
39 ```
40
41 The provider resolves the Docker binary from the `DOCKER_BIN`
42 environment variable, falling back to `docker` on the `PATH`.
43
44 ## Registry credentials
45
46 Registry auth is a per-resource prop, not global configuration.
47 [`Image`](/providers/docker/image) and
48 [`RemoteImage`](/providers/docker/remoteimage) accept a `registry`
49 with `{ server, username, password }`, where `password` is a
50 `Redacted` value:
51
52 ```typescript
53 const image = yield* Docker.Image("app", {
54 name: "my-app",
55 build: { context: "./app" },
56 registry: {
57 server: "ghcr.io",
58 username: "octocat",
59 password: Config.Redacted("GITHUB_TOKEN"),
60 },
61 });
62 ```
63
64 Push deliberately skips `docker login`: the credentials are written
65 into an isolated `DOCKER_CONFIG` that only the push command reads, so
66 your global docker config, buildx builders, and `docker context`
67 setup stay intact.
68
69 ## Next steps
70
71 - [Docker overview](/docker) — resources and compositions.
72 - [Run local services](/docker/local-services) — Postgres with a
73 network, volume, and healthcheck.
74 - [Build and push an image](/docker/build-and-push) — Dockerfile
75 builds and registry push.