Skip to content

Volume

Source: src/Docker/Volume.ts

A Docker volume managed through the active Docker context.

Pre-existing same-name volumes are treated as foreign until the engine is allowed to adopt them with --adopt or adopt(true).

Basic volume

const data = yield* Docker.Volume("data", {
name: "app-data",
});

PostgreSQL data volume

const data = yield* Docker.Volume("postgres-data");

Driver options and labels

const data = yield* Docker.Volume("db-data", {
driver: "local",
driverOpts: {
type: "nfs",
o: "addr=10.0.0.1,rw",
device: ":/path/to/dir",
},
labels: {
"com.example.usage": "database",
},
});