add -v|--volume to bind mount host path into a service container

This commit is contained in:
Pavel Sviderski
2024-12-27 21:25:33 +10:00
parent 042b44cbb6
commit 2a898b3eee
3 changed files with 11 additions and 2 deletions
+2
View File
@@ -42,6 +42,8 @@ type ContainerSpec struct {
Image string
// Run a custom init inside the container. If nil, use the daemon's configured settings.
Init *bool
// List of volumes to bind mount into the container.
Volumes []string
}
func (s *ContainerSpec) Validate() error {
+1
View File
@@ -268,6 +268,7 @@ func (cli *Client) runContainer(
}
}
hostConfig := &container.HostConfig{
Binds: spec.Container.Volumes,
Init: spec.Container.Init,
PortBindings: portBindings,
}