Browse Source
DockerRunner: podman workaround: create volume host dir when it doesn't exist. (#1062)
pull/1119/head
Tom Deseyn
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
10 additions and
0 deletions
-
src/Microsoft.Tye.Core/ContainerEngine.cs
-
src/Microsoft.Tye.Hosting/DockerRunner.cs
|
|
|
@ -31,6 +31,7 @@ namespace Microsoft.Tye |
|
|
|
|
|
|
|
public string AspNetUrlsHost => _aspnetUrlsHost; |
|
|
|
public string? ContainerHost => _containerHost; |
|
|
|
public bool IsPodman => _isPodman; |
|
|
|
|
|
|
|
public Task<int> ExecuteAsync( |
|
|
|
string args, |
|
|
|
|
|
|
|
@ -285,6 +285,15 @@ namespace Microsoft.Tye.Hosting |
|
|
|
if (volumeMapping.Source != null) |
|
|
|
{ |
|
|
|
var sourcePath = Path.GetFullPath(Path.Combine(application.ContextDirectory, volumeMapping.Source)); |
|
|
|
if (application.ContainerEngine.IsPodman) |
|
|
|
{ |
|
|
|
// unlike docker, podman doesn't create the host directory when it doesn't exist.
|
|
|
|
// https://github.com/containers/podman/issues/10471
|
|
|
|
if (!File.Exists(sourcePath) && !Directory.Exists(sourcePath)) |
|
|
|
{ |
|
|
|
Directory.CreateDirectory(sourcePath); |
|
|
|
} |
|
|
|
} |
|
|
|
volumes += $"-v \"{sourcePath}:{volumeMapping.Target}:{(volumeMapping.ReadOnly ? "ro," : "")}z\" "; |
|
|
|
} |
|
|
|
else if (volumeMapping.Name != null) |
|
|
|
|