使用
github.com/fsouza/go-dockerclient,您首先必须创建一个容器,使用
CreateContainerOptions来添加可以通过命令行添加的相同选项。
container, err := client.CreateContainer(createContainerOptions)
有了容器后,您可以使用中的任何其他选项或替代项来启动容器
HostConfig
client.StartContainer(container.ID, hostConfig)
要连接到容器的std
io流,需要使用
client.AttachToContainer,并在中分配适当的流
AttachToContinerOptions。



