Пример #1
0
func newContainerUploader(client *docker.Client, container, path string) io.WriteCloser {
	r, w := io.Pipe()

	go func() {
		opts := docker.UploadToContainerOptions{
			Path:        path,
			InputStream: r,
		}
		r.CloseWithError(client.UploadToContainer(container, opts))
	}()

	return w
}
Пример #2
0
func newContainerUploader(client *docker.Client, container, path string) (io.WriteCloser, <-chan error) {
	r, w := io.Pipe()
	errch := make(chan error, 1)

	go func() {
		opts := docker.UploadToContainerOptions{
			Path:        path,
			InputStream: r,
		}
		errch <- client.UploadToContainer(container, opts)
	}()

	return w, errch
}