Skip to content

fix #7916 by using DOTNET_RUNNING_IN_CONTAINERS env var to detect container #9903

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

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
s/DockerUtils/ContainerUtils/g
  • Loading branch information
analogrelay committed May 2, 2019
commit f01a86496c8bbb864742fe4787e7d1a2afc1fb9f
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public FileSystemXmlRepository(DirectoryInfo directory, ILoggerFactory loggerFac

try
{
if (DockerUtils.IsContainer && !DockerUtils.IsVolumeMountedFolder(Directory))
if (ContainerUtils.IsContainer && !ContainerUtils.IsVolumeMountedFolder(Directory))
{
// warn users that keys may be lost when running in docker without a volume mounted folder
_logger.UsingEphemeralFileSystemLocationInContainer(Directory.FullName);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) .NET Foundation. All rights reserved.
/ Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System.IO;
Expand All @@ -8,7 +8,7 @@

namespace Microsoft.AspNetCore.DataProtection.Test
{
public class DockerUtilsTests
public class ContainerUtilsTests
{
// example of content from /proc/self/mounts
private static readonly string[] fstab = new []
Expand Down Expand Up @@ -37,7 +37,7 @@ public class DockerUtilsTests
[InlineData("../dir")]
public void DeterminesFolderIsNotMounted(string directory)
{
Assert.False(DockerUtils.IsDirectoryMounted(new DirectoryInfo(directory), fstab));
Assert.False(ContainerUtils.IsDirectoryMounted(new DirectoryInfo(directory), fstab));
}

[ConditionalTheory]
Expand All @@ -50,7 +50,7 @@ public void DeterminesFolderIsNotMounted(string directory)
[InlineData("/app/subdir/two/")]
public void DeterminesFolderIsMounted(string directory)
{
Assert.True(DockerUtils.IsDirectoryMounted(new DirectoryInfo(directory), fstab));
Assert.True(ContainerUtils.IsDirectoryMounted(new DirectoryInfo(directory), fstab));
}
}
}