(DEPRECATED) Deploy a DC/OS cluster

Warning

The Azure Container Service (ACS) is being deprecated. No new features or functionality are being added to ACS. All of the APIs, portal experience, CLI commands and documentation are marked as deprecated.

For more information, see the Azure Container Service deprecation announcement on Azure.com.

We recommend that you deploy one of the following Azure Marketplace solutions:

If you want to use Kubernetes, see Azure Kubernetes Service.

DC/OS provides a distributed platform for running modern and containerized applications. With Azure Container Service, provisioning of a production ready DC/OS cluster is simple and quick. This quick start details the basic steps needed to deploy a DC/OS cluster and run basic workload.

If you don't have an Azure subscription, create a free account before you begin.

This tutorial requires the Azure CLI version 2.0.4 or later. Run az --version to find the version. If you need to upgrade, see Install the Azure CLI.

Log in to Azure

Log in to your Azure subscription with the az login command and follow the on-screen directions.

az login

Create a resource group

Create a resource group with the az group create command. An Azure resource group is a logical container into which Azure resources are deployed and managed.

The following example creates a resource group named myResourceGroup in the eastus location.

az group create --name myResourceGroup --location eastus

Create DC/OS cluster

Create a DC/OS cluster with the az acs create command.

The following example creates a DC/OS cluster named myDCOSCluster and creates SSH keys if they do not already exist. To use a specific set of keys, use the --ssh-key-value option.

az acs create --orchestrator-type dcos --resource-group myResourceGroup --name myDCOSCluster --generate-ssh-keys

In some cases, such as with a limited trial, an Azure subscription has limited access to Azure resources. If the deployment fails due to limited available cores, reduce the default agent count by adding --agent-count 1 to the az acs create command.

After several minutes, the command completes, and returns information about the deployment.

Connect to DC/OS cluster

Once a DC/OS cluster has been created, it can be accesses through an SSH tunnel. Run the following command to return the public IP address of the DC/OS master. This IP address is stored in a variable and used in the next step.

ip=$(az network public-ip list --resource-group myResourceGroup --query "[?contains(name,'dcos-master')].[ipAddress]" -o tsv)

To create the SSH tunnel, run the following command and follow the on-screen instructions. If port 80 is already in use, the command fails. Update the tunneled port to one not in use, such as 85:localhost:80.

sudo ssh -i ~/.ssh/id_rsa -fNL 80:localhost:80 -p 2200 azureuser@$ip

The SSH tunnel can be tested by browsing to http://localhost. If a port other that 80 has been used, adjust the location to match.

If the SSH tunnel was successfully created, the DC/OS portal is returned.

DCOS UI

Install DC/OS CLI

The DC/OS command line interface is used to manage a DC/OS cluster from the command-line. Install the DC/OS cli using the az acs dcos install-cli command. If you are using Azure CloudShell, the DC/OS CLI is already installed.

If you are running the Azure CLI on macOS or Linux, you might need to run the command with sudo.

az acs dcos install-cli

Before the CLI can be used with the cluster, it must be configured to use the SSH tunnel. To do so, run the following command, adjusting the port if needed.

dcos config set core.dcos_url http://localhost

Run an application

The default scheduling mechanism for an ACS DC/OS cluster is Marathon. Marathon is used to start an application and manage the state of the application on the DC/OS cluster. To schedule an application through Marathon, create a file named marathon-app.json, and copy the following contents into it.

{
  "id": "demo-app",
  "cmd": null,
  "cpus": 1,
  "mem": 32,
  "disk": 0,
  "instances": 1,
  "container": {
    "docker": {
      "image": "nginx",
      "network": "BRIDGE",
      "portMappings": [
        {
          "containerPort": 80,
          "hostPort": 80,
          "protocol": "tcp",
          "name": "80",
          "labels": null
        }
      ]
    },
    "type": "DOCKER"
  },
  "acceptedResourceRoles": [
    "slave_public"
  ]
}

Run the following command to schedule the application to run on the DC/OS cluster.

dcos marathon app add marathon-app.json

To see the deployment status for the app, run the following command.

dcos marathon app list

When the WAITING column value switches from True to False, application deployment has completed.

ID     MEM  CPUS  TASKS  HEALTH  DEPLOYMENT  WAITING  CONTAINER  CMD   
/test   32   1     1/1    ---       ---      False      DOCKER   None

Get the public IP address of the DC/OS cluster agents.

az network public-ip list --resource-group myResourceGroup --query "[?contains(name,'dcos-agent')].[ipAddress]" -o tsv

Browsing to this address returns the default NGINX site.

NGINX

Delete DC/OS cluster

When no longer needed, you can use the az group delete command to remove the resource group, DC/OS cluster, and all related resources.

az group delete --name myResourceGroup --no-wait

Next steps

In this quick start, you’ve deployed a DC/OS cluster and have run a simple Docker container on the cluster. To learn more about Azure Container Service, continue to the ACS tutorials.