diff --git a/worker/docker/docker.go b/worker/docker/docker.go index a99b2094..5abf3edd 100644 --- a/worker/docker/docker.go +++ b/worker/docker/docker.go @@ -21,6 +21,7 @@ func RunContainer(name, image string, commands [][]string, env []string, dir str return err } defer close(logch) + var shell string resp, err := createContainer(cli, name, image, dir, []string{"/bin/bash"}, env) if err != nil { @@ -34,6 +35,9 @@ func RunContainer(name, image string, commands [][]string, env []string, dir str logch <- []byte(err.Error()) return err } + shell = "sh" + } else { + shell = "bash" } } defer cli.ContainerRemove(ctx, resp.ID, types.ContainerRemoveOptions{Force: true}) @@ -52,7 +56,7 @@ func RunContainer(name, image string, commands [][]string, env []string, dir str } str := yellow("\r==> " + strings.Join(command, " ") + "\n\r") logch <- []byte(str) - command = []string{"bash", "-ci", strings.Join(command, " ")} + command = []string{shell, "-ci", strings.Join(command, " ")} conn, execID, err := exec(cli, containerID, command, env) if err != nil { logch <- []byte(err.Error()) diff --git a/worker/docker/image.go b/worker/docker/image.go index 07a5c128..8719e6e2 100644 --- a/worker/docker/image.go +++ b/worker/docker/image.go @@ -7,7 +7,6 @@ import ( "encoding/base64" "encoding/binary" "encoding/json" - "fmt" "io" "io/ioutil" "path" @@ -100,23 +99,6 @@ func PullImage(image string, config *config.Registry) error { opts.RegistryAuth = base64.URLEncoding.EncodeToString(authJSON) } - if config.Addr != "" && !strings.Contains(config.Addr, "docker.io") { - pimage := fmt.Sprintf("%s/%s", config.Addr, image) - - out, err := cli.ImagePull(ctx, pimage, opts) - if err == nil { - defer out.Close() - ioutil.ReadAll(out) - return nil - } - } - - if !strings.Contains(image, "/") && !strings.HasPrefix(image, "docker.io") { - image = fmt.Sprintf("docker.io/library/%s", image) - } else if strings.Contains(image, "/") && !strings.HasPrefix(image, "docker.io") { - image = fmt.Sprintf("docker.io/%s", image) - } - out, err := cli.ImagePull(ctx, image, opts) if err == nil { defer out.Close()