I am currently trying to create a Docker container using the official GoLang Docker SDK and am trying to mount a volume from my localhost to the docker container.
vol := map[string]struct{}{"/pathInDocker":{}}
// This was prepared using example at:
//https://docs.docker.com/develop/sdk/examples/#run-a-container
res, err := cli.ContainerCreate(ctx, &container.Config{
Image: testImageName,
Volumes: vol,
Cmd: []string{"ls", "/"},
}, nil, nil, "")
This works at creating the container and adding the "/pathInDocker" to the docker container, however, I cannot figure out how to add the mount point for the localhost.
I have tried the following possible values for the vol variable
vol := map[string]struct{}{"localPath:/pathInDocker":{}}
vol := map[string]struct{}{"\"localPath\":\"/pathInDocker\"":{}}
And for each of these the resulting docker container attempts to mount the map key as the folder in docker with not mount point for localhost.
I've dug through the docs and the only line I can seem to find talking about how to configure volumes at all is this one:
Volumes map[string]struct{} // List of volumes (mounts) used for the container
So my question is how to configure this so it mounts a local folder to the volume?