docker sdk for container creation

106 views Asked by At

I am using go-sdk for docker to create a container by code along the following lines

resp, err := cli.ContainerCreate(ctx, &container.Config{
        Image: "alpine",
        Cmd:   []string{"echo", "hello world"},
    }, nil, nil, ""/* This is container name argument*/)

I understand that the argument that takes container name, if i use the same name twice, docker engine will reject it. Also unless a stopped container is removed, the name cannot be used. My question now is that if i send such a request back to back, is the server side code thread safe or it is possible that 2 such containers may come up for a short while? Basically I looked at the rest api server handler for that and did not understand much as to what the behavior will be.

0

There are 0 answers