docs-aspire icon indicating copy to clipboard operation
docs-aspire copied to clipboard

Podman from WSL not found

Open carlcamilleri opened this issue 1 year ago • 6 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Describe the bug

Environment setup:

  • .NET Aspire app code checked out in the default WSL distribution
  • Podman installed as a separate WSL distribution
  • ~/.bash_aliases contains alias podman='podman-remote-static-linux_amd64'
  • In the WSL terminal, running podman images runs successfully

Error encountered: : Container runtime 'podman' could not be found. The error from the container runtime check was: exec: "podman": executable file not found in $PATH

Expected Behavior

No response

Steps To Reproduce

No response

Exceptions (if any)

No response

.NET Version info

No response

Anything else?

No response

carlcamilleri avatar Sep 09 '24 05:09 carlcamilleri

Looks similar to https://github.com/dotnet/aspire/issues/5571. Unable to find an executable on the path. I wonder if this is to do with where the apphost was launched from.

davidfowl avatar Sep 09 '24 06:09 davidfowl

Thank you! Adding some more context of the terminal environment below, just in case it helps.

I have also verified that copying /usr/local/bin/podman-remote-static-linux_amd64 to /usr/local/bin/podman allows the Aspire application to run fine

machine_name:~/loremipsum/Product.AppHost$ alias
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias grep='grep --color=auto'
alias l='ls -CF'
alias la='ls -A'
alias ll='ls -alF'
alias ls='ls --color=auto'
alias podman='podman-remote-static-linux_amd64'

machine_name:~/loremipsum/Product.AppHost$ dotnet --version
8.0.303

machine_name:~/loremipsum/Product.AppHost$ dotnet workload list
Installed Workload Id      Manifest Version      Installation Source
--------------------------------------------------------------------
aspire                     8.2.0/8.0.100         SDK 8.0.300        

Use `dotnet workload search` to find additional workloads to install.


machine_name::~/loremipsum/Product.AppHost$ dotnet run
Building...
info: Aspire.Hosting.DistributedApplication[0]
      Aspire version: 8.2.0+75fdcff28495bdd643f6323133a7d411df71ab70
info: Aspire.Hosting.DistributedApplication[0]
      Distributed application starting.
info: Aspire.Hosting.DistributedApplication[0]
      Application host directory is: ~/loremipsum/Product.AppHost
fail: Microsoft.Extensions.Hosting.Internal.Host[11]
      Hosting failed to start
      Aspire.Hosting.DistributedApplicationException: Container runtime 'podman' could not be found. The error from the container runtime check was: exec: "podman": executable file not found in $PATH
      failed to start podman command 'Info'.
      See https://aka.ms/dotnet/aspire/containers for more details on supported container runtimes.
         at Aspire.Hosting.Dcp.DcpDependencyCheck.EnsureDcpContainerRuntime(DcpInfo dcpInfo) in /_/src/Aspire.Hosting/Dcp/DcpDependencyCheck.cs:line 205
         at Aspire.Hosting.Dcp.DcpDependencyCheck.GetDcpInfoAsync(CancellationToken cancellationToken) in /_/src/Aspire.Hosting/Dcp/DcpDependencyCheck.cs:line 110
         at Aspire.Hosting.Dcp.DcpDependencyCheck.GetDcpInfoAsync(CancellationToken cancellationToken) in /_/src/Aspire.Hosting/Dcp/DcpDependencyCheck.cs:line 130
         at Aspire.Hosting.Dcp.DcpHostService.StartAsync(CancellationToken cancellationToken) in /_/src/Aspire.Hosting/Dcp/DcpHostService.cs:line 67
         at Microsoft.Extensions.Hosting.Internal.Host.<StartAsync>b__15_1(IHostedService service, CancellationToken token)
         at Microsoft.Extensions.Hosting.Internal.Host.ForeachService[T](IEnumerable`1 services, CancellationToken token, Boolean concurrent, Boolean abortOnFirstException, List`1 exceptions, Func`3 operation)
Unhandled exception. System.AggregateException: One or more errors occurred. (Container runtime 'podman' could not be found. The error from the container runtime check was: exec: "podman": executable file not found in $PATH
failed to start podman command 'Info'.
See https://aka.ms/dotnet/aspire/containers for more details on supported container runtimes.)
 ---> Aspire.Hosting.DistributedApplicationException: Container runtime 'podman' could not be found. The error from the container runtime check was: exec: "podman": executable file not found in $PATH
failed to start podman command 'Info'.
See https://aka.ms/dotnet/aspire/containers for more details on supported container runtimes.
   at Aspire.Hosting.Dcp.DcpDependencyCheck.EnsureDcpContainerRuntime(DcpInfo dcpInfo) in /_/src/Aspire.Hosting/Dcp/DcpDependencyCheck.cs:line 205
   at Aspire.Hosting.Dcp.DcpDependencyCheck.GetDcpInfoAsync(CancellationToken cancellationToken) in /_/src/Aspire.Hosting/Dcp/DcpDependencyCheck.cs:line 110
   at Aspire.Hosting.Dcp.DcpDependencyCheck.GetDcpInfoAsync(CancellationToken cancellationToken) in /_/src/Aspire.Hosting/Dcp/DcpDependencyCheck.cs:line 130
   at Aspire.Hosting.Dcp.DcpHostService.StartAsync(CancellationToken cancellationToken) in /_/src/Aspire.Hosting/Dcp/DcpHostService.cs:line 67
   at Microsoft.Extensions.Hosting.Internal.Host.<StartAsync>b__15_1(IHostedService service, CancellationToken token)
   at Microsoft.Extensions.Hosting.Internal.Host.ForeachService[T](IEnumerable`1 services, CancellationToken token, Boolean concurrent, Boolean abortOnFirstException, List`1 exceptions, Func`3 operation)
   at Microsoft.Extensions.Hosting.Internal.Host.StartAsync(CancellationToken cancellationToken)
   at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
   at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
   at Aspire.Hosting.DistributedApplication.RunAsync(CancellationToken cancellationToken) in /_/src/Aspire.Hosting/DistributedApplication.cs:line 311
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at System.Threading.Tasks.Task.Wait()
   at Aspire.Hosting.DistributedApplication.Run() in /_/src/Aspire.Hosting/DistributedApplication.cs:line 339
   at Program.<Main>$(String[] args) in ~/loremipsum/Product/Product.AppHost/Program.cs:line 11

carlcamilleri avatar Sep 09 '24 08:09 carlcamilleri

Unfortanetly you can't alias the command to be resovled correctly, podman will need to be part of the environment path.

dbreshears avatar Sep 16 '24 18:09 dbreshears

At the risk of being a pain, this means Aspire is unusable under the Podman installation instructions at https://podman-desktop.io/docs/podman/accessing-podman-from-another-wsl-instance

I’m guessing this is not an isolated case, so if it will not be supported I guess it needs to be documented

carlcamilleri avatar Sep 16 '24 18:09 carlcamilleri

Let's add this to the docs for now.

davidfowl avatar Sep 16 '24 18:09 davidfowl

Also it would be nice if you could update the tasks for the Applied Skill https://learn.microsoft.com/en-us/credentials/applied-skills/build-distributed-apps-with-dotnet-aspire/ which requires podman

alexander-kastil avatar Oct 13 '24 15:10 alexander-kastil