code: func writeEtcHosts(cfg *RunConfig, rootfs string) {
  	if cfg.DNSConfMode.Hosts != "stage0" {
  		return
  	}
  
  	// Read <stage1>/rootfs/etc/hosts-fallback to get some sane defaults
  	hostsTextb, err := ioutil.ReadFile(filepath.Join(rootfs, "etc/hosts-fallback"))
  	if err != nil {
  		// fallback-fallback :-)
  		hostsTextb = []byte("#created by rkt stage0\n127.0.0.1 localhost localhost.localdomain\n")
  	}
  	hostsText := string(hostsTextb)
  
  	hostsText += "\n\n# Added by rkt run --hosts-entry\n"
  
  	for ip, hostnames := range cfg.HostsEntries {
  		hostsText = fmt.Sprintf("%s%s %s\n", hostsText, ip, strings.Join(hostnames, " "))
  	}
  
  	// Create /etc if it does not exist
  	etcPath := filepath.Join(rootfs, "etc")
  	if _, err := os.Stat(etcPath); err != nil && os.IsNotExist(err) {
  		err = os.Mkdir(etcPath, 0755)
  		if err != nil {
  			log.FatalE("failed to make stage1 etc directory", err)
  		}
  	} else if err != nil {
  		log.FatalE("Failed to stat stage1 etc", err)
  	}
  
  	hostsPath := filepath.Join(etcPath, "rkt-hosts")
  	err = ioutil.WriteFile(hostsPath, []byte(hostsText), 0644)
  	if err != nil {
  		log.FatalE("failed to write etc/rkt-hosts", err)
  	}
  }
docs: // writeEtcHosts writes the file /etc/rkt-hosts into the stage1 rootfs.
  // This will read defaults from <rootfs>/etc/hosts-fallback if it exists.
  // Therefore, this should be called after the stage1 is mounted