You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Containers can mount host paths (withBindMounts) and tmpfs (withTmpFs). There is no API for named volumes.
Sharing data between containers, or keeping data across a container being replaced, needs a host directory.
Bind mounts depend on the host filesystem being visible to the Docker daemon, which is not the case for a remote daemon and for some CI setups.
withBindMounts([{ source: "my-volume", target: "/data" }]) does create a named volume, because Docker treats a source that is not a path as a volume name. That is undocumented here, and the volume gets no Testcontainers labels, so nothing removes it. stop({ removeVolumes: true }) only removes anonymous volumes.
Expected
A Volume with the same lifecycle as Network: created on demand, labelled with the session so it is cleaned up, disposable with await using.
withVolumeMounts([{ volume, target, readOnly }]) on the builder.
Activity