Deploy Aspire applications to remote Docker hosts via SSH.
This package extends Aspire's Docker Compose support with a deployment pipeline that builds container images locally, pushes them to a registry, and deploys to a remote server via SSH. The pipeline handles SSH connection management, file transfers, and container orchestration with docker compose.
flowchart LR
A[Dev Machine / CI<br/>aspire deploy] -->|SSH| B[Target Server<br/>docker compose up]
The deployment pipeline executes in phases, with steps running in parallel where possible:
flowchart TD
subgraph Configure
A[Establish SSH] --> B[Configure Deployment]
C[Process Parameters] --> D[Build Prerequisites]
end
subgraph Build & Push
D --> E[Build Images]
E --> F[Push to Registry]
end
subgraph Deploy
F --> G[Prepare Compose Files]
G --> H[Transfer Files via SCP]
H --> I[docker compose up]
I --> J[Health Checks]
end
J --> K[Done]
Phase breakdown:
- Configure - Establish SSH connection, gather parameters (registry, credentials, deploy path)
- Build - Build container images for each project in parallel
- Push - Push images to the configured container registry
- Deploy - Transfer compose files and
.envto the remote server, rundocker compose up - Verify - Run health checks, extract dashboard token, cleanup SSH
Run aspire do diagnostics to see the full dependency graph for your application.
- Add the package feed:
dotnet nuget add source https://f.feedz.io/davidfowl/aspire/nuget/index.json --name davidfowl-aspire- Install the package:
aspire add docker-sshdeployOr with the .NET CLI:
dotnet add package Aspire.Hosting.Docker.SshDeploy --prerelease- Add SSH deployment support to your AppHost:
builder.AddDockerComposeEnvironment("env")
.WithSshDeploySupport();- Deploy:
aspire deployThe pipeline will prompt for SSH credentials, registry configuration, and deploy path.
See the package README for:
- Configuration options (
appsettings.json, environment variables) - SSH authentication (key-based vs password)
- Target host privacy settings
See samples/DockerPipelinesSample for a complete example:
aspire run # Run locally
aspire deploy # Deploy to remote hostSee .github/workflows/deploy.yml for a complete example using GitHub Container Registry with secrets for SSH credentials.