summaryrefslogtreecommitdiff
path: root/pkg/adapter/containers_remote.go
diff options
context:
space:
mode:
authorbaude <bbaude@redhat.com>2019-03-20 13:00:34 -0500
committerbaude <bbaude@redhat.com>2019-04-08 09:05:31 -0500
commitba65301c955454e47c3893ca548f18a845a4c4a9 (patch)
tree4704ac2ce61efd5790a0e4dc06560d6eda38bc51 /pkg/adapter/containers_remote.go
parentd86729e743fb5a58b9364ee5e991b5db2e9dd600 (diff)
downloadpodman-ba65301c955454e47c3893ca548f18a845a4c4a9.tar.gz
podman-ba65301c955454e47c3893ca548f18a845a4c4a9.tar.bz2
podman-ba65301c955454e47c3893ca548f18a845a4c4a9.zip
podman-remote create|run
add the ability to create and run containers via the podman-remote client. we now create an intermediate layer from the the create/run cli flags. the intermediate layer can be converted into a createconfig or into a varlink struct. Once transported, the varlink struct can be converted back to an intermediate layer and then to a createconfig. remote terminals are not supported yet. Signed-off-by: baude <bbaude@redhat.com>
Diffstat (limited to 'pkg/adapter/containers_remote.go')
-rw-r--r--pkg/adapter/containers_remote.go30
1 files changed, 30 insertions, 0 deletions
diff --git a/pkg/adapter/containers_remote.go b/pkg/adapter/containers_remote.go
index 2982d6cbb..3730827c7 100644
--- a/pkg/adapter/containers_remote.go
+++ b/pkg/adapter/containers_remote.go
@@ -262,3 +262,33 @@ func (r *LocalRuntime) Log(c *cliconfig.LogsValues, options *libpod.LogOptions)
}
return nil
}
+
+// CreateContainer creates a container from the cli over varlink
+func (r *LocalRuntime) CreateContainer(ctx context.Context, c *cliconfig.CreateValues) (string, error) {
+ if !c.Bool("detach") {
+ // TODO need to add attach when that function becomes available
+ return "", errors.New("the remote client only supports detached containers")
+ }
+ results := shared.NewIntermediateLayer(&c.PodmanCommand)
+ return iopodman.CreateContainer().Call(r.Conn, results.MakeVarlink())
+}
+
+// Run creates a container overvarlink and then starts it
+func (r *LocalRuntime) Run(ctx context.Context, c *cliconfig.RunValues, exitCode int) (int, error) {
+ // TODO the exit codes for run need to be figured out for remote connections
+ if !c.Bool("detach") {
+ return 0, errors.New("the remote client only supports detached containers")
+ }
+ results := shared.NewIntermediateLayer(&c.PodmanCommand)
+ cid, err := iopodman.CreateContainer().Call(r.Conn, results.MakeVarlink())
+ if err != nil {
+ return 0, err
+ }
+ fmt.Println(cid)
+ _, err = iopodman.StartContainer().Call(r.Conn, cid)
+ return 0, err
+}
+
+func ReadExitFile(runtimeTmp, ctrID string) (int, error) {
+ return 0, libpod.ErrNotImplemented
+}