From 82feafecdda8040432c008d9b79e4f973009adfc Mon Sep 17 00:00:00 2001 From: baude Date: Wed, 16 May 2018 12:38:17 -0500 Subject: podman create, start, getattachsocket First pass at implement API endpoints for create and start. Signed-off-by: baude Closes: #805 Approved by: baude --- libpod/container_attach.go | 4 ++-- libpod/container_internal.go | 12 +++++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) (limited to 'libpod') diff --git a/libpod/container_attach.go b/libpod/container_attach.go index 3677a3d78..65c878bff 100644 --- a/libpod/container_attach.go +++ b/libpod/container_attach.go @@ -81,9 +81,9 @@ func (c *Container) attachContainerSocket(resize <-chan remotecommand.TerminalSi logrus.Warnf("Failed to write to control file to resize terminal: %v", err) } }) - logrus.Debug("connecting to socket ", c.attachSocketPath()) + logrus.Debug("connecting to socket ", c.AttachSocketPath()) - conn, err := net.DialUnix("unixpacket", nil, &net.UnixAddr{Name: c.attachSocketPath(), Net: "unixpacket"}) + conn, err := net.DialUnix("unixpacket", nil, &net.UnixAddr{Name: c.AttachSocketPath(), Net: "unixpacket"}) if err != nil { return errors.Wrapf(err, "failed to connect to container's attach socket: %v") } diff --git a/libpod/container_internal.go b/libpod/container_internal.go index 39a665bb1..e34a79eb1 100644 --- a/libpod/container_internal.go +++ b/libpod/container_internal.go @@ -106,14 +106,20 @@ func (c *Container) rwSize() (int64, error) { return c.runtime.store.DiffSize(layer.Parent, layer.ID) } -// The path to the container's root filesystem - where the OCI spec will be +// bundlePath returns the path to the container's root filesystem - where the OCI spec will be // placed, amongst other things func (c *Container) bundlePath() string { return c.config.StaticDir } -// Retrieves the path of the container's attach socket -func (c *Container) attachSocketPath() string { +// ControlSocketPath returns the path to the containers control socket for things like tty +// resizing +func (c *Container) ControlSocketPath() string { + return filepath.Join(c.bundlePath(), "ctl") +} + +// AttachSocketPath retrieves the path of the container's attach socket +func (c *Container) AttachSocketPath() string { return filepath.Join(c.runtime.ociRuntime.socketsDir, c.ID(), "attach") } -- cgit v1.2.3-54-g00ecf