1
0
mirror of https://github.com/rancher/os.git synced 2025-07-31 22:47:16 +00:00

Support higher verion docker-ce as system-docker

This commit is contained in:
niusmallnan 2018-02-27 17:55:59 +08:00 committed by niusmallnan
parent a7ba5d045b
commit 43f483a5ef
5 changed files with 17 additions and 12 deletions

View File

@ -175,14 +175,14 @@ func startDocker(cfg *config.CloudConfig) error {
return err
}
cmd := []string{"docker-runc", "exec", "--", info.ID, "env"}
cmd := []string{"system-docker-runc", "exec", "--", info.ID, "env"}
log.Info(dockerCfg.AppendEnv())
cmd = append(cmd, dockerCfg.AppendEnv()...)
cmd = append(cmd, dockerCommand...)
cmd = append(cmd, args...)
log.Infof("Running %v", cmd)
return syscall.Exec("/usr/bin/ros", cmd, os.Environ())
return syscall.Exec("/usr/bin/system-docker-runc", cmd, os.Environ())
}
func waitForPid(service string, project *project.Project) (int, error) {

View File

@ -8,7 +8,7 @@ import (
)
func (d *DockerConfig) FullArgs() []string {
args := []string{"daemon"}
args := []string{}
args = append(args, generateEngineOptsSlice(d.EngineOpts)...)
args = append(args, d.ExtraArgs...)
if d.TLS {

View File

@ -25,7 +25,7 @@ const (
ModulesArchive = "/modules.tar"
Debug = false
SystemDockerLog = "/var/log/system-docker.log"
SystemDockerBin = "/usr/bin/system-docker"
SystemDockerBin = "/usr/bin/system-dockerd"
HashLabel = "io.rancher.os.hash"
IDLabel = "io.rancher.os.id"

View File

@ -55,6 +55,9 @@ func (s *Service) missingImage() bool {
}
client := s.context.ClientFactory.Create(s)
_, _, err := client.ImageInspectWithRaw(context.Background(), image, false)
if err != nil {
log.Errorf("Missing the image: %v", err)
}
return err != nil
}

View File

@ -2,11 +2,13 @@ package init
import (
"os"
"os/exec"
"path"
"syscall"
"golang.org/x/net/context"
"github.com/docker/engine-api/types"
"github.com/docker/libcompose/project/options"
"github.com/rancher/os/cmd/control"
"github.com/rancher/os/compose"
@ -74,22 +76,22 @@ func loadImages(cfg *config.CloudConfig) (*config.CloudConfig, error) {
continue
}
// client.ImageLoad is an asynchronous operation
// To ensure the order of execution, use cmd instead of it
inputFileName := path.Join(config.ImagesPath, image)
input, err := os.Open(inputFileName)
if err != nil {
return cfg, err
}
defer input.Close()
log.Infof("Loading images from %s", inputFileName)
if _, err = client.ImageLoad(context.Background(), input, true); err != nil {
if err = exec.Command("/usr/bin/system-docker", "load", "-q", "-i", inputFileName).Run(); err != nil {
log.Fatalf("FATAL: failed loading images from %s: %s", inputFileName, err)
}
log.Infof("Done loading images from %s", inputFileName)
}
dockerImages, _ := client.ImageList(context.Background(), types.ImageListOptions{})
for _, dimg := range dockerImages {
log.Infof("Got image repo tags: %s", dimg.RepoTags)
}
return cfg, nil
}