code: func (c *ContainerServer) ContainerRename(container, name string) error {
  	ctr, err := c.LookupContainer(container)
  	if err != nil {
  		return err
  	}
  
  	oldName := ctr.Name()
  	_, err = c.ReserveContainerName(ctr.ID(), name)
  	if err != nil {
  		return err
  	}
  	defer func() {
  		if err != nil {
  			c.ReleaseContainerName(name)
  		} else {
  			c.ReleaseContainerName(oldName)
  		}
  	}()
  
  	// Update state.json
  	if err = c.updateStateName(ctr, name); err != nil {
  		return err
  	}
  
  	// Update config.json
  	configRuntimePath := filepath.Join(ctr.BundlePath(), configFile)
  	if err = updateConfigName(configRuntimePath, name); err != nil {
  		return err
  	}
  	configStoragePath := filepath.Join(ctr.Dir(), configFile)
  	if err = updateConfigName(configStoragePath, name); err != nil {
  		return err
  	}
  
  	// Update containers.json
  	if err = c.store.SetNames(ctr.ID(), []string{name}); err != nil {
  		return err
  	}
  	return nil
  }
docs: // ContainerRename renames the given container