Thursday 20 April 2017

Get Started, Part 6: Deploy your app

Prerequisites

  • Install Docker.
  • Read the orientation in Part 1.
  • Learn how to create containers in Part 2.
  • Make sure you have pushed the container you created to a registry, as instructed; we’ll be using it here.
  • Ensure your image is working by running this and visiting http://localhost/ (slotting in your info for usernamerepo, and tag):
    docker run -p 80:80 username/repo:tag
    
  • Have the final version of docker-compose.yml from Part 5 handy.

Introduction

You’ve been editing the same Compose file for this entire tutorial. Well, we have good news: that Compose file works just as well in production as it does on your machine. Here, we go through some options for running your Dockerized application.

Choose an option

If you’re okay with using Docker Community Edition in production, you can use Docker Cloud to help manage your app on popular cloud providers such as Amazon Web Services, DigitalOcean, and Microsoft Azure.
To set up and deploy:
  • Connect Docker Cloud with your preferred provider, granting Docker Cloud permission to automatically provision and “Dockerize” VMs for you.
  • Use Docker Cloud to create your computing resources and create your swarm.
  • Deploy your app.
Note: We will be linking into the Docker Cloud documentation here; be sure to come back to this page after completing each step.

Connect Docker Cloud

First, link Docker Cloud with your cloud provider:

Create your swarm

After your cloud provider is all set up, create a Swarm:

Deploy your app

Connect to your swarm via Docker Cloud. This opens a terminal whose context is your local machine, but whose Docker commands are routed up to the swarm running on your cloud provider. This is a little different from the paradigm you’ve been following, where you were slinging commands via SSH; now, you can directly access both your local file system and your remote swarm, enabling some very tidy-looking commands:
docker stack deploy -c docker-compose.yml getstartedlab
That’s it! Your app is running in production and is managed by Docker Cloud.

Congratulations!

You’ve taken a full-stack, dev-to-deploy tour of the entire Docker platform.
There is much more to the Docker platform than what was covered here, but you have a good idea of the basics of containers, images, services, swarms, stacks, scaling, load-balancing, volumes, and placement constraints.

No comments:

Post a Comment

User Interface(UI) for Docker, Portainer

Portainer gives you access to a central overview of your Docker host or Swarm cluster. From the dashboard, you can easily access any manag...