Docker
Docker builds an application into an image, a layered filesystem snapshot plus the command to run, and runs images as isolated containers on a Docker engine, on your laptop, a CI runner or a server. Registries carry images between machines, which is why nearly every cloud runs containers from them. Swarm, built into the engine, runs replicated services across a cluster of engines.
New to Docker? Start with What is Docker?.
A quick example
Section titled “A quick example”Pull Postgres and run it with its data on a volume:
import * as Alchemy from "alchemy";import * as Docker from "@alchemy.run/docker";import * as Config from "effect/Config";import * as Effect from "effect/Effect";
export default Alchemy.Stack( "MyApp", { providers: Docker.providers(), state: Alchemy.localState(), }, Effect.gen(function* () { const data = yield* Docker.Volume("postgres-data");
const postgres = yield* Docker.Container("postgres", { image: "postgres:18-alpine", environment: { POSTGRES_PASSWORD: yield* Config.Redacted("POSTGRES_PASSWORD") }, ports: [{ external: 15432, internal: 5432 }], volumes: [{ hostPath: data.name, containerPath: "/var/lib/postgresql/data" }], start: true, });
return { ports: postgres.ports }; }),);Build your own image from a Dockerfile, and push it to a registry:
const image = yield* Docker.Image("api", { name: "acme/api", build: { context: "./api" }, registry: { server: "ghcr.io", username: "acme", password: yield* Config.Redacted("GITHUB_TOKEN"), },});Deploy, and Alchemy creates everything on the engine your docker CLI talks to:
pnpm alchemy deploybun alchemy deploynpx alchemy deployyarn alchemy deployWhere to start
Section titled “Where to start”Want to build? Install the provider in Setup, then follow Local Postgres step by step.
Looking for something specific? Every section of these docs is listed below, and every resource is in the generated API reference.