Skip to content

Instantly share code, notes, and snippets.

@sixeyed
Last active May 31, 2017 13:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sixeyed/62bf7be72dae6c9ece6ceec745baff36 to your computer and use it in GitHub Desktop.
Save sixeyed/62bf7be72dae6c9ece6ceec745baff36 to your computer and use it in GitHub Desktop.
Secure Docker engine on Azure VM and copy certs to local
$serverName = 'my.server.region.cloudapp.azure.com'
$externalIP = '1.2.3.4'
$internalIP = '10.0.0.4'
mkdir -p C:\certs\vm\client
docker run --rm `
-e SERVER_NAME= $serverName `
-e IP_ADDRESSES=127.0.0.1,$externalIP,$internalIP `
-v 'C:\ProgramData\docker:C:\ProgramData\docker' `
-v 'C:\certs\vm\client:C:\Users\ContainerAdministrator\.docker' `
stefanscherer/dockertls-windows
Restart-Service docker
Enable-PSRemoting -Force
Set-NetFirewallProfile -Profile Domain,Public,Private -Enabled False
$serverName = 'my.server.region.cloudapp.azure.com'
winrm set winrm/config/client '@{TrustedHosts="$serverName"}'
$SourceSession = New-PSSession -ComputerName $serverName -Credential (Get-Credential)
mkdir -p C:\certs\azure-vm
Copy-Item -FromSession $SourceSession -Path 'C:\certs\vm\client\' -Destination 'C:\certs\azure-vm\' -Recurse
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment