system-docker.go 478 B

123456789101112131415161718192021222324252627
  1. package systemdocker
  2. import (
  3. "os"
  4. "strings"
  5. "syscall"
  6. log "github.com/Sirupsen/logrus"
  7. "github.com/rancherio/os/config"
  8. )
  9. func Main() {
  10. var newEnv []string
  11. for _, env := range os.Environ() {
  12. if !strings.HasPrefix(env, "DOCKER_HOST=") {
  13. newEnv = append(newEnv, env)
  14. }
  15. }
  16. newEnv = append(newEnv, "DOCKER_HOST="+config.DOCKER_SYSTEM_HOST)
  17. os.Args[0] = "/usr/bin/docker"
  18. if err := syscall.Exec(os.Args[0], os.Args, newEnv); err != nil {
  19. log.Fatal(err)
  20. }
  21. }