code: func (daemon *Daemon) RestartSwarmContainers() {
  	ctx := context.Background()
  
  	// parallelLimit is the maximum number of parallel startup jobs that we
  	// allow (this is the limited used for all startup semaphores). The multipler
  	// (128) was chosen after some fairly significant benchmarking -- don't change
  	// it unless you've tested it significantly (this value is adjusted if
  	// RLIMIT_NOFILE is small to avoid EMFILE).
  	parallelLimit := adjustParallelLimit(len(daemon.List()), 128*runtime.NumCPU())
  
  	var group sync.WaitGroup
  	sem := semaphore.NewWeighted(int64(parallelLimit))
  
  	for _, c := range daemon.List() {
  		if !c.IsRunning() && !c.IsPaused() {
  			// Autostart all the containers which has a
  			// swarm endpoint now that the cluster is
  			// initialized.
  			if daemon.configStore.AutoRestart && c.ShouldRestart() && c.NetworkSettings.HasSwarmEndpoint && c.HasBeenStartedBefore {
  				group.Add(1)
  				go func(c *container.Container) {
  					if err := sem.Acquire(ctx, 1); err != nil {
  						// ctx is done.
  						group.Done()
  						return
  					}
  
  					if err := daemon.containerStart(c, "", "", true); err != nil {
  						logrus.Error(err)
  					}
  
  					sem.Release(1)
  					group.Done()
  				}(c)
  			}
  		}
  	}
  	group.Wait()
  }
docs: // RestartSwarmContainers restarts any autostart container which has a
  // swarm endpoint.