Deploying Our App on a Swarm

Learn how to deploy your Rails app on the Swarm.

Deploy app onto single-node

With our newly created docker-stack.yml, we have a description of our app that Swarm can use. We are ready to deploy our app onto our (single-node) swarm. First, retarget Swarm by:

$ eval $(docker-machine env local-vm-1)

Command to deploy app

Now we can deploy our app with the command:

$ docker stack deploy -c docker-stack.yml myapp
Creating network myapp_default
Creating service myapp_web
Creating service myapp_redis
Creating service myapp_database
Creating service myapp_db-migrator

This says, “Deploy the services described in docker-stack.yml as a stack called myapp.”

Command to view services

You can see the various services being created. We can list the services in our stack by running:

Get hands-on with 1200+ tech skills courses.