Once you’ve created an Azure Container Service (ACS) deployment running Docker Swarm (as opposed to DC/OS) the next step is to be able to deploy to it from your dev machine, build machine, etc… The goal here is to be able to run
docker run ... and get containers running on the Swarm cluster.
Ensure Master has Public IP
The first step will be ensure that your master has a public IP and an SSH port open, if you’ve already done this skip ahead to “Connect with Swarm”. You’ll need to ensure the machine has both a public IP attached, as well as a network security group attached.
To add a public IP:
- Find the master VM in your resource list
- Go to
- If the first entry has both public and private IPs listed, skip ahead to the network security group portion.
- Select the first entry, and go to
Settings > IP Addresses
- Enable the public IP address and save.
To add the network security group:
- Follow steps 1-3 of adding a public IP above to get to
Settings > Network security group
- If there isn’t a group listed select Edit and then select an existing group. (If one doesn’t exist already you’ll have to create one in
New Resource -> Network Security Group. Come back here after doing that)
- Select your NSG and go to
Settings > Inbound Security Rules
Addand Enter ssh for the name and
22for the Destination Port Number.
Wait for the operation to complete and you should now be able to SSH into the master machine with the username you created when you created the cluster, and the SSH key you specified.
Connect with Swarm
Once your ACS master is properly configured with a public IP and ssh is enabled we just need two simple commands to connect to it:
ssh -L 2375:localhost:2375 <azureuser>@<masterHostOrIP> export DOCKER_HOST="tcp://localhost:2375" docker info
Be sure to replace
azureuser with your username and
masterHostOrIP with the dnsname of your ACS master or the IP address of your master.
This sets up an SSH tunnel to your master, and forwards port
2375 from the master to your local machine. We then set the
DOCKER_HOST environment variable to point docker to the forwarded port. If the
docker info command works you should see the information for your swarm cluster printed out, containing a list of agent nodes in the cluster. You can now use regular
docker commands, and even
No comments yet.