Package io.github.pgatzka.docker.dsl
Class Mounts
java.lang.Object
io.github.pgatzka.docker.dsl.Mounts
Mutable builder for a container's volume and bind mounts. Configured inside a container spec via
mounts { volume(...); bind(...) } and flushed into immutable snapshots at task time.-
Constructor Summary
ConstructorsConstructorDescriptionMounts()Default constructor for use byContainerSpec; not intended for direct use. -
Method Summary
Modifier and TypeMethodDescriptionvoidRegister a read-write host bind mount.voidRegister a host bind mount.binds()Snapshot the registered bind mounts.Names of the volumes referenced by registered volume mounts, in declaration order.voidRegister a read-write named-volume mount.voidRegister a named-volume mount.volumes()Snapshot the registered volume mounts.
-
Constructor Details
-
Mounts
public Mounts()Default constructor for use byContainerSpec; not intended for direct use.
-
-
Method Details
-
volume
Register a read-write named-volume mount.- Parameters:
volumeName- name of a volume declared indocker.volumescontainerPath- absolute path inside the container
-
volume
Register a named-volume mount.- Parameters:
volumeName- name of a volume declared indocker.volumescontainerPath- absolute path inside the containerreadOnly-trueto mount read-only
-
bind
Register a read-write host bind mount.- Parameters:
hostPath- absolute or project-relative path on the hostcontainerPath- absolute path inside the container
-
bind
Register a host bind mount.- Parameters:
hostPath- absolute or project-relative path on the hostcontainerPath- absolute path inside the containerreadOnly-trueto mount read-only
-
volumes
Snapshot the registered volume mounts.- Returns:
- an immutable snapshot of currently-registered volume mounts
-
binds
Snapshot the registered bind mounts.- Returns:
- an immutable snapshot of currently-registered bind mounts
-
referencedVolumeNames
Names of the volumes referenced by registered volume mounts, in declaration order. Useful for cross-checking againstdocker.volumes.- Returns:
- referenced volume names
-