Commit d259bc2d authored by duanjinfei's avatar duanjinfei

updage model container start gpu driver

parent b2313b9b
...@@ -173,11 +173,15 @@ func (d *DockerOp) CreateContainer(imageName string, dockerCmd *models.DockerCmd ...@@ -173,11 +173,15 @@ func (d *DockerOp) CreateContainer(imageName string, dockerCmd *models.DockerCmd
HostPort: dockerCmd.HostPort, HostPort: dockerCmd.HostPort,
}, },
} }
portMap := nat.PortMap{} exposePortSet := make(nat.PortSet)
portMap = make(map[nat.Port][]nat.PortBinding, 0) natPort, _ := nat.NewPort("tcp", dockerCmd.ContainerPort)
portMap[nat.Port(dockerCmd.ContainerPort+"/tcp")] = portBinds exposePortSet[natPort] = struct{}{}
portMap := make(nat.PortMap)
portMap[natPort] = portBinds
resp, err := d.dockerClient.ContainerCreate(ctx, &container.Config{ resp, err := d.dockerClient.ContainerCreate(ctx, &container.Config{
ExposedPorts: exposePortSet,
Image: imageName, Image: imageName,
Tty: false,
}, &container.HostConfig{ }, &container.HostConfig{
PortBindings: portMap, PortBindings: portMap,
AutoRemove: true, // 容器停止后自动删除 AutoRemove: true, // 容器停止后自动删除
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment