Talking to custom docker daemon URI without docker-machine
Added a limited support to use the FluentAPI to talk to a remote docker daemon without using docker-machine. This is done either by manually creating a instance of a DockerHostService
or use FromUri
on HostBuilder
.
using(var container = Fd.UseHost().
FromUri(Settings.DockerUri, isWindowsHost: true).
UseContainer().
Build())
{
}
The above sample connects to a custom DockerUri
from a setting and is a windows container docker daemon.
FromUri
that uses aDockerUri
to create aIHostService
. This uri is arbitrary. It also support other properties (see below).
public HostBuilder FromUri(
DockerUri uri,
string name = null,
bool isNative = true,
bool stopWhenDisposed = false,
bool isWindowsHost = false,
string certificatePath = null) {/*...*/}
It will use "sensible" defaults on all parameters. Most of the case the uri is sufficient. For example if not providing the certificatePath it will try to get it from the environment DOCKER_CERT_PATH. If not found in the environment, it will default to none.
UseHost
that takes a instantiatedIHostService
implementation.