summaryrefslogtreecommitdiff
path: root/pkg/specgen
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-04-06 16:16:49 -0400
committerGitHub <noreply@github.com>2021-04-06 16:16:49 -0400
commitd83f49ef6b8a53535257bb56f5573ef3f65e3ba9 (patch)
tree913102be0b4701edc9907e326e249deaf2a75a2f /pkg/specgen
parentb7dd714532e0445438e9c5fc5be7f8e0271c21d0 (diff)
parent6acd265306370ab5cfeaf2843bd359fe13216d92 (diff)
downloadpodman-d83f49ef6b8a53535257bb56f5573ef3f65e3ba9.tar.gz
podman-d83f49ef6b8a53535257bb56f5573ef3f65e3ba9.tar.bz2
podman-d83f49ef6b8a53535257bb56f5573ef3f65e3ba9.zip
Merge pull request #9754 from mheon/add_dep
Add --requires flag to podman run/create
Diffstat (limited to 'pkg/specgen')
-rw-r--r--pkg/specgen/generate/container_create.go11
-rw-r--r--pkg/specgen/specgen.go7
2 files changed, 18 insertions, 0 deletions
diff --git a/pkg/specgen/generate/container_create.go b/pkg/specgen/generate/container_create.go
index 1d724ffb0..ef9975021 100644
--- a/pkg/specgen/generate/container_create.go
+++ b/pkg/specgen/generate/container_create.go
@@ -364,6 +364,17 @@ func createContainerOptions(ctx context.Context, rt *libpod.Runtime, s *specgen.
if len(s.Secrets) != 0 {
options = append(options, libpod.WithSecrets(s.Secrets))
}
+ if len(s.DependencyContainers) > 0 {
+ deps := make([]*libpod.Container, 0, len(s.DependencyContainers))
+ for _, ctr := range s.DependencyContainers {
+ depCtr, err := rt.LookupContainer(ctr)
+ if err != nil {
+ return nil, errors.Wrapf(err, "%q is not a valid container, cannot be used as a dependency", ctr)
+ }
+ deps = append(deps, depCtr)
+ }
+ options = append(options, libpod.WithDependencyCtrs(deps))
+ }
return options, nil
}
diff --git a/pkg/specgen/specgen.go b/pkg/specgen/specgen.go
index c10dc5ef5..28111f96d 100644
--- a/pkg/specgen/specgen.go
+++ b/pkg/specgen/specgen.go
@@ -160,10 +160,17 @@ type ContainerBasicConfig struct {
// to 0, 1, 2) that will be passed to the executed process. The total FDs
// passed will be 3 + PreserveFDs.
// set tags as `json:"-"` for not supported remote
+ // Optional.
PreserveFDs uint `json:"-"`
// Timezone is the timezone inside the container.
// Local means it has the same timezone as the host machine
+ // Optional.
Timezone string `json:"timezone,omitempty"`
+ // DependencyContainers is an array of containers this container
+ // depends on. Dependency containers must be started before this
+ // container. Dependencies can be specified by name or full/partial ID.
+ // Optional.
+ DependencyContainers []string `json:"dependencyContainers,omitempty"`
}
// ContainerStorageConfig contains information on the storage configuration of a