Skip to content

Commit

Permalink
when "standard" daemon addresses in use skip -H
Browse files Browse the repository at this point in the history
This allows the docker-compose v2 to work properly. Need to introduce docker
contexts thogh :)
  • Loading branch information
mariotoffia committed Dec 8, 2021
1 parent 095bcf3 commit 8749b52
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 11 deletions.
21 changes: 13 additions & 8 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,31 +1,33 @@
{
"cSpell.words": [
"Ductus",
"Exploaded",
"Ipam",
"LOCALAPPDATA",
"Miscellanious",
"NOPASSWD",
"Npgsql",
"Toffia",
"appconfig",
"archve",
"behaviour",
"compsed",
"cref",
"dont",
"Ductus",
"editorconfig",
"Exploaded",
"flaviours",
"fluentdockerdl",
"fluentdockertest",
"Imageverficiation",
"Ipam",
"kiasaki",
"LOCALAPPDATA",
"lxss",
"mariotoffia",
"martoffi",
"Miscellanious",
"mkdir",
"myimg",
"mysecretpassword",
"mytag",
"nodetest",
"NOPASSWD",
"Npgsql",
"npipe",
"nuget",
"particulary",
"postgres",
Expand All @@ -34,6 +36,9 @@
"proto",
"somewordpress",
"sudoer",
"tlscacert",
"tlscert",
"Toffia",
"typeof",
"wdlp"
],
Expand Down
6 changes: 3 additions & 3 deletions Ductus.FluentDocker/Extensions/CommandExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public static class CommandExtensions

/// <summary>
/// Reads a <see cref="ConsoleStream{T}" /> until <see cref="ConsoleStream{T}.IsFinished" /> is set to true
/// or a timeout occured on a read.
/// or a timeout occurred on a read.
/// </summary>
/// <typeparam name="T">The type of returned items in the console stream.</typeparam>
/// <param name="stream">The stream to read from.</param>
Expand Down Expand Up @@ -214,10 +214,10 @@ public static IPAddress EmulatedNativeAddress(bool useCache = true)
return _cachedDockerIpAddress;
}

internal static string RenderBaseArgs(this Uri host, ICertificatePaths certificates = null)
internal static string RenderBaseArgs(this DockerUri host, ICertificatePaths certificates = null)
{
var args = string.Empty;
if (null != host)
if (null != host && !host.IsStandardDaemon)
{
args = $" -H {host}";
}
Expand Down
11 changes: 11 additions & 0 deletions Ductus.FluentDocker/Model/Common/DockerUri.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ public sealed class DockerUri : Uri

public DockerUri(string uriString) : base(uriString)
{
if (uriString == DockerHostUrlMacOrLinux || uriString == DockerHostUrlWindowsNative)
this.IsStandardDaemon = true;
}

public static string GetDockerHostEnvironmentPathOrDefault()
Expand All @@ -31,6 +33,15 @@ public static string GetDockerHostEnvironmentPathOrDefault()
return CommandExtensions.IsToolbox() ? DockerHostUrlLegacy : DockerHostUrlMacOrLinux;
}

/// <summary>
/// Returns true if the DockerUri has a "standard" daemon URI.
/// </summary>
/// <value>True if standard daemon, false otherwise.</value>
/// <remarks>
/// If it is a standard daemon URI, there's no need to add the -H flag
/// </remarks>
public bool IsStandardDaemon {get;}

public override string ToString()
{
var baseString = base.ToString();
Expand Down

0 comments on commit 8749b52

Please sign in to comment.