Skip to content

Commit

Permalink
Merge pull request #238 from mariotoffia/quickfix-compose-h-removal
Browse files Browse the repository at this point in the history
Simple support for docker-compose v2
  • Loading branch information
mariotoffia authored Dec 8, 2021
2 parents c9a4fad + 8749b52 commit 90ad078
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 @@ -195,10 +195,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 90ad078

Please sign in to comment.