summaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
Diffstat (limited to 'libpod')
-rw-r--r--libpod/adapter/runtime_remote.go38
-rw-r--r--libpod/container_internal.go23
2 files changed, 51 insertions, 10 deletions
diff --git a/libpod/adapter/runtime_remote.go b/libpod/adapter/runtime_remote.go
index f63b5875d..b1d4d4d25 100644
--- a/libpod/adapter/runtime_remote.go
+++ b/libpod/adapter/runtime_remote.go
@@ -161,14 +161,30 @@ func (r *LocalRuntime) NewImageFromLocal(name string) (*ContainerImage, error) {
// LoadFromArchiveReference creates an image from a local archive
func (r *LocalRuntime) LoadFromArchiveReference(ctx context.Context, srcRef types.ImageReference, signaturePolicyPath string, writer io.Writer) ([]*ContainerImage, error) {
+ var iid string
// TODO We need to find a way to leak certDir, creds, and the tlsverify into this function, normally this would
// come from cli options but we don't want want those in here either.
tlsverify := true
- imageID, err := iopodman.PullImage().Call(r.Conn, srcRef.DockerReference().String(), "", "", signaturePolicyPath, &tlsverify)
+ reply, err := iopodman.PullImage().Send(r.Conn, varlink.More, srcRef.DockerReference().String(), "", "", signaturePolicyPath, &tlsverify)
if err != nil {
return nil, err
}
- newImage, err := r.NewImageFromLocal(imageID)
+
+ for {
+ responses, flags, err := reply()
+ if err != nil {
+ return nil, err
+ }
+ for _, line := range responses.Logs {
+ fmt.Print(line)
+ }
+ iid = responses.Id
+ if flags&varlink.Continues == 0 {
+ break
+ }
+ }
+
+ newImage, err := r.NewImageFromLocal(iid)
if err != nil {
return nil, err
}
@@ -177,6 +193,7 @@ func (r *LocalRuntime) LoadFromArchiveReference(ctx context.Context, srcRef type
// New calls into local storage to look for an image in local storage or to pull it
func (r *LocalRuntime) New(ctx context.Context, name, signaturePolicyPath, authfile string, writer io.Writer, dockeroptions *image.DockerRegistryOptions, signingoptions image.SigningOptions, forcePull bool, label *string) (*ContainerImage, error) {
+ var iid string
if label != nil {
return nil, errors.New("the remote client function does not support checking a remote image for a label")
}
@@ -194,11 +211,24 @@ func (r *LocalRuntime) New(ctx context.Context, name, signaturePolicyPath, authf
tlsVerifyPtr = &tlsVerify
}
- imageID, err := iopodman.PullImage().Call(r.Conn, name, dockeroptions.DockerCertPath, "", signaturePolicyPath, tlsVerifyPtr)
+ reply, err := iopodman.PullImage().Send(r.Conn, varlink.More, name, dockeroptions.DockerCertPath, "", signaturePolicyPath, tlsVerifyPtr)
if err != nil {
return nil, err
}
- newImage, err := r.NewImageFromLocal(imageID)
+ for {
+ responses, flags, err := reply()
+ if err != nil {
+ return nil, err
+ }
+ for _, line := range responses.Logs {
+ fmt.Print(line)
+ }
+ iid = responses.Id
+ if flags&varlink.Continues == 0 {
+ break
+ }
+ }
+ newImage, err := r.NewImageFromLocal(iid)
if err != nil {
return nil, err
}
diff --git a/libpod/container_internal.go b/libpod/container_internal.go
index b5f93c8a0..e3753d825 100644
--- a/libpod/container_internal.go
+++ b/libpod/container_internal.go
@@ -652,16 +652,19 @@ func (c *Container) startDependencies(ctx context.Context) error {
return errors.Wrapf(err, "error generating dependency graph for container %s", c.ID())
}
- ctrErrors := make(map[string]error)
- // reset ctrsVisisted for next round of recursion
- ctrsVisited := make(map[string]bool)
-
// If there are no containers without dependencies, we can't start
// Error out
if len(graph.noDepNodes) == 0 {
+ // we have no dependencies that need starting, go ahead and return
+ if len(graph.nodes) == 0 {
+ return nil
+ }
return errors.Wrapf(ErrNoSuchCtr, "All dependencies have dependencies of %s", c.ID())
}
+ ctrErrors := make(map[string]error)
+ ctrsVisited := make(map[string]bool)
+
// Traverse the graph beginning at nodes with no dependencies
for _, node := range graph.noDepNodes {
startNode(ctx, node, false, ctrErrors, ctrsVisited, true)
@@ -698,10 +701,18 @@ func (c *Container) getAllDependencies(visited map[string]*Container) error {
if err != nil {
return err
}
- visited[depID] = dep
- if err := dep.getAllDependencies(visited); err != nil {
+ status, err := dep.State()
+ if err != nil {
return err
}
+ // if the dependency is already running, we can assume its dependencies are also running
+ // so no need to add them to those we need to start
+ if status != ContainerStateRunning {
+ visited[depID] = dep
+ if err := dep.getAllDependencies(visited); err != nil {
+ return err
+ }
+ }
}
}
return nil