podman build is not using the default oci-runtime

Currently if the user installs runc in an alternative path
podman run uses it but podman build does not.

This patch will pass the default oci runtime to be used by podman
down to the image builder.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
Daniel J Walsh
2018-12-28 11:23:11 -05:00
parent c50332d057
commit 652a985998
2 changed files with 10 additions and 1 deletions

View File

@ -205,6 +205,10 @@ func buildCmd(c *cli.Context) error {
}
namespaceOptions.AddOrReplace(usernsOption...)
ociruntime := runtime.GetOCIRuntimePath()
if c.IsSet("runtime") {
ociruntime = c.String("runtime")
}
options := imagebuildah.BuildOptions{
ContextDirectory: contextDir,
PullPolicy: pullPolicy,
@ -217,7 +221,7 @@ func buildCmd(c *cli.Context) error {
Out: stdout,
Err: stderr,
ReportWriter: reporter,
Runtime: c.String("runtime"),
Runtime: ociruntime,
RuntimeArgs: runtimeFlags,
OutputFormat: format,
SystemContext: systemContext,

View File

@ -180,6 +180,11 @@ func (r *Runtime) GetConmonVersion() (string, error) {
return strings.TrimSuffix(strings.Replace(output, "\n", ", ", 1), "\n"), nil
}
// GetOCIRuntimePath returns the path to the OCI Runtime Path the runtime is using
func (r *Runtime) GetOCIRuntimePath() string {
return r.ociRuntimePath
}
// GetOCIRuntimeVersion returns a string representation of the oci runtimes version
func (r *Runtime) GetOCIRuntimeVersion() (string, error) {
output, err := utils.ExecCmd(r.ociRuntimePath, "--version")