Deploy a multi-service app

Estimated reading time: 4 minutes

This topic applies to Docker Enterprise.

The Docker Enterprise platform business, including products, customers, and employees, has been acquired by Mirantis, inc., effective 13-November-2019. For more information on the acquisition and how it may affect you and your business, refer to the Docker Enterprise Customer FAQ.

Docker Universal Control Plane allows you to use the tools you already know, like docker stack deploy to deploy multi-service applications. You can also deploy your applications from the UCP web UI.

In this example we’ll deploy a multi-service application that allows users to vote on whether they prefer cats or dogs.

version: "3"

  # A Redis key-value store to serve as message queue
    image: redis:alpine
      - "6379"
      - frontend

  # A PostgreSQL database for persistent storage
    image: postgres:9.4
      - db-data:/var/lib/postgresql/data
      - backend

  # Web UI for voting
    image: dockersamples/examplevotingapp_vote:before
      - 5000:80
      - frontend
      - redis

  # Web UI to count voting results
    image: dockersamples/examplevotingapp_result:before
      - 5001:80
      - backend
      - db

  # Worker service to read from message queue
    image: dockersamples/examplevotingapp_worker
      - frontend
      - backend



From the web UI

To deploy your applications from the UCP web UI, on the left navigation bar expand Shared resources, choose Stacks, and click Create stack.

Stack list

Choose the name you want for your stack, and choose Swarm services as the deployment mode.

When you choose this option, UCP deploys your app using the Docker swarm built-in orchestrator. If you choose ‘Basic containers’ as the deployment mode, UCP deploys your app using the classic Swarm orchestrator.

Then copy-paste the application definition in docker-compose.yml format.

Deploy stack

Once you’re done click Create to deploy the stack.

From the CLI

To deploy the application from the CLI, start by configuring your Docker CLI using a UCP client bundle.

Then, create a file named docker-stack.yml with the content of the yaml above, and run:

docker stack deploy --compose-file voting_app
docker-compose --file docker-compose.yml --project-name voting_app up -d

Check your app

Once the multi-service application is deployed, it shows up in the UCP web UI. The ‘Stacks’ page shows that you’ve deployed the voting app.

Stack deployed

You can also inspect the individual services of the app you deployed. For that, click the voting_app to open the details pane, open Inspect resources and choose Services, since this app was deployed with the built-in Docker swarm orchestrator.

Service list

You can also use the Docker CLI to check the status of your app:

docker stack ps voting_app

Great! The app is deployed so we can cast votes by accessing the service that’s listening on port 5000. You don’t need to know the ports a service listens to. You can click the voting_app_vote service and click on the Published endpoints link.

Voting app


When deploying applications from the web UI, you can’t reference any external files, no matter if you’re using the built-in swarm orchestrator or classic Swarm. For that reason, the following keywords are not supported:

  • build
  • dockerfile
  • env_file

Also, UCP doesn’t store the stack definition you’ve used to deploy the stack. You can use a version control system for this.

ucp, deploy, application, stack, service, compose