Merge pull request #937 from AkihiroSuda/rename-docker-connhelper

connhelper: docker -> docker-container
docker-19.03
Tõnis Tiigi 2019-04-15 23:42:55 -07:00 committed by GitHub
commit 5d13cca4a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 27 deletions

View File

@ -1,26 +0,0 @@
// Package connhelper provides helpers for connecting to a remote daemon host with custom logic.
package connhelper
import (
"context"
"net"
"net/url"
"github.com/docker/cli/cli/connhelper/commandconn"
"github.com/moby/buildkit/client/connhelper"
)
func init() {
connhelper.Register("docker", DockerHelper)
}
// DockerHelper returns helper for connecting to Docker container.
// docker://<container> URL requires BuildKit v0.5.0 or later in the container.
func DockerHelper(u *url.URL) (*connhelper.ConnectionHelper, error) {
container := u.Host
return &connhelper.ConnectionHelper{
ContextDialer: func(ctx context.Context, addr string) (net.Conn, error) {
return commandconn.New(ctx, "docker", "exec", "-i", container, "buildctl", "dial-stdio")
},
}, nil
}

View File

@ -0,0 +1,26 @@
// Package dockercontainer provides connhelper for docker-container://<container>
package dockercontainer
import (
"context"
"net"
"net/url"
"github.com/docker/cli/cli/connhelper/commandconn"
"github.com/moby/buildkit/client/connhelper"
)
func init() {
connhelper.Register("docker-container", DockerContainerHelper)
}
// DockerContainerHelper returns helper for connecting to Docker container.
// docker-container://<container> URL requires BuildKit v0.5.0 or later in the container.
func DockerContainerHelper(u *url.URL) (*connhelper.ConnectionHelper, error) {
container := u.Host
return &connhelper.ConnectionHelper{
ContextDialer: func(ctx context.Context, addr string) (net.Conn, error) {
return commandconn.New(ctx, "docker", "exec", "-i", container, "buildctl", "dial-stdio")
},
}, nil
}

View File

@ -4,7 +4,7 @@ import (
"fmt"
"os"
_ "github.com/moby/buildkit/client/connhelper/docker"
_ "github.com/moby/buildkit/client/connhelper/dockercontainer"
bccommon "github.com/moby/buildkit/cmd/buildctl/common"
"github.com/moby/buildkit/util/apicaps"
"github.com/moby/buildkit/util/appdefaults"