aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/fsouza/go-dockerclient/container_archive.go
diff options
context:
space:
mode:
authorValentin Rothberg <rothberg@redhat.com>2020-10-26 11:35:02 +0100
committerValentin Rothberg <rothberg@redhat.com>2020-10-29 15:06:22 +0100
commit65a618886efc48562e5b9ff99ca630c83622419b (patch)
tree09d19a7f6fe596a1b9e19fec6e45288f2b76de5a /vendor/github.com/fsouza/go-dockerclient/container_archive.go
parentcce6c6cd40137c460f173300b36c5868383870c5 (diff)
downloadpodman-65a618886efc48562e5b9ff99ca630c83622419b.tar.gz
podman-65a618886efc48562e5b9ff99ca630c83622419b.tar.bz2
podman-65a618886efc48562e5b9ff99ca630c83622419b.zip
new "image" mount type
Add a new "image" mount type to `--mount`. The source of the mount is the name or ID of an image. The destination is the path inside the container. Image mounts further support an optional `rw,readwrite` parameter which if set to "true" will yield the mount writable inside the container. Note that no changes are propagated to the image mount on the host (which in any case is read only). Mounts are overlay mounts. To support read-only overlay mounts, vendor a non-release version of Buildah. Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Diffstat (limited to 'vendor/github.com/fsouza/go-dockerclient/container_archive.go')
-rw-r--r--vendor/github.com/fsouza/go-dockerclient/container_archive.go58
1 files changed, 58 insertions, 0 deletions
diff --git a/vendor/github.com/fsouza/go-dockerclient/container_archive.go b/vendor/github.com/fsouza/go-dockerclient/container_archive.go
new file mode 100644
index 000000000..6c7e61c79
--- /dev/null
+++ b/vendor/github.com/fsouza/go-dockerclient/container_archive.go
@@ -0,0 +1,58 @@
+package docker
+
+import (
+ "context"
+ "fmt"
+ "io"
+ "net/http"
+ "time"
+)
+
+// UploadToContainerOptions is the set of options that can be used when
+// uploading an archive into a container.
+//
+// See https://goo.gl/g25o7u for more details.
+type UploadToContainerOptions struct {
+ InputStream io.Reader `json:"-" qs:"-"`
+ Path string `qs:"path"`
+ NoOverwriteDirNonDir bool `qs:"noOverwriteDirNonDir"`
+ Context context.Context
+}
+
+// UploadToContainer uploads a tar archive to be extracted to a path in the
+// filesystem of the container.
+//
+// See https://goo.gl/g25o7u for more details.
+func (c *Client) UploadToContainer(id string, opts UploadToContainerOptions) error {
+ url := fmt.Sprintf("/containers/%s/archive?", id) + queryString(opts)
+
+ return c.stream(http.MethodPut, url, streamOptions{
+ in: opts.InputStream,
+ context: opts.Context,
+ })
+}
+
+// DownloadFromContainerOptions is the set of options that can be used when
+// downloading resources from a container.
+//
+// See https://goo.gl/W49jxK for more details.
+type DownloadFromContainerOptions struct {
+ OutputStream io.Writer `json:"-" qs:"-"`
+ Path string `qs:"path"`
+ InactivityTimeout time.Duration `qs:"-"`
+ Context context.Context
+}
+
+// DownloadFromContainer downloads a tar archive of files or folders in a container.
+//
+// See https://goo.gl/W49jxK for more details.
+func (c *Client) DownloadFromContainer(id string, opts DownloadFromContainerOptions) error {
+ url := fmt.Sprintf("/containers/%s/archive?", id) + queryString(opts)
+
+ return c.stream(http.MethodGet, url, streamOptions{
+ setRawTerminal: true,
+ stdout: opts.OutputStream,
+ inactivityTimeout: opts.InactivityTimeout,
+ context: opts.Context,
+ })
+}