Docker Community Forums

Share and learn in the Docker community.

Swarm init using golang SDK

I am trying to use golang SDK for Swarm Init as follows:

resp, err := cli.SwarmInit(context.Background(), swarm.InitRequest{ListenAddr: "0.0.0.0:2377",AdvertiseAddr:"x.x.x.x",})
fmt.Printf("got resp: %s, err: %s", resp, err)

I don’t see the response returning the jointoken for workers. How can I get the token?