feat: very basic context management

Taken from this gist by github.com/agbaraka

https://gist.github.com/agbaraka/654a218f8ea13b3da8a47d47595f5d05

There is no in-built way of dealing with contexts using the golang sdk.

This means we have to make our own Dial helper borrowing from Docker CLI

This means all Docker API calls are made within the ssh connection

This uses `docker system dial-stdio`
This commit is contained in:
2021-07-16 09:32:20 +01:00
parent c65ae974dd
commit 5e1b076bf9
4 changed files with 858 additions and 31 deletions

12
client/connection.go Normal file
View File

@ -0,0 +1,12 @@
package client
import "github.com/docker/cli/cli/connhelper"
func newConnectionHelper(daemonURL string) *connhelper.ConnectionHelper {
helper, err := connhelper.GetConnectionHelper(daemonURL)
if err != nil {
panic(err)
}
return helper
}