Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simple support for docker-compose v2 #238

Merged
merged 1 commit into from
Dec 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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