Table of Contents

Docker Deployment

Deploy PoshMcp in Docker containers for consistent environments and cloud deployment.

Building a Docker Image

Clone and build:

git clone https://github.com/microsoft/poshmcp.git
cd poshmcp

docker build -t poshmcp:latest .

Running the Container

HTTP Mode

docker run -p 8080:8080 poshmcp:latest

Stdio Mode

docker run -it poshmcp:latest poshmcp serve --transport stdio

Pre-installing PowerShell Modules

Build a custom image with modules pre-installed:

docker build \
  --build-arg MODULES="Az.Accounts Az.Resources Az.Storage" \
  -t poshmcp:azure .

Or configure at runtime:

docker run \
  -e POSHMCP_MODULES="Az.Accounts Az.Resources" \
  -p 8080:8080 \
  poshmcp:latest

Custom Configuration

Mount your appsettings.json:

docker run -v $(pwd)/appsettings.json:/app/appsettings.json \
  -p 8080:8080 \
  poshmcp:latest

Environment Variables

docker run \
  -e POSHMCP_TRANSPORT=http \
  -e POSHMCP_LOG_LEVEL=debug \
  -e POSHMCP_MODULES="Az.Accounts" \
  -p 8080:8080 \
  poshmcp:latest

Azure Container Apps Deployment

See Azure Integration for full deployment guide with Managed Identity setup, monitoring, and scaling.

Quick deploy:

cd infrastructure/azure
./deploy.sh

Next: Environment Customization | Azure Integration