So I am busy using http://godoc.org/github.com/samalba/dockerclient
Using CreateContainer (http://godoc.org/github.com/samalba/dockerclient#DockerClient.CreateContainer)
To setup a new container
containerConfig := &dockerclient.ContainerConfig{
Image: imageName,
AttachStdin: true,
AttachStdout: true,
AttachStderr: true}
containerID, err = docker.CreateContainer(containerConfig, containerName)
works correctly and I get a container, however, there is no exposed ports. Looking at the docker API(https://docs.docker.com/reference/api/docker_remote_api_v1.15/), I need to set
"ExposedPorts - An object mapping ports to an empty object in the form of: "ExposedPorts": { "/: {}" }"
Looking at the godoc for the Go dockclient lib I am using, I see you can pass it as
ExposedPorts map[string]struct{}
But I have no idea on what to do here, from the docker api example passing :
"ExposedPorts":{
"22/tcp": {}
}
is enough, so how do I do the struct bit in the my containerConfig?