Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to deploy applications with Docker Cloud

2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces "how to deploy applications with Docker Cloud". In daily operation, I believe many people have doubts about how to deploy applications with Docker Cloud. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts about "how to deploy applications with Docker Cloud". Next, please follow the editor to study!

If you work well with docker community edition in a production environment, you can use docker cloud to help manage applications from major service providers such as amazon web services, digitalocean, and microsoft azure.

The setup and deployment process is to connect docker cloud to your preferred provider, grant docker cloud permissions, automatically configure and dockerize virtual machines for you, create your computing resources and clusters using docker cloud, and deploy your applications.

Connect docker cloud

You can run docker cloud under or. If you are running docker cloud in standard mode, follow these instructions to connect your service provider to docker cloud:

Amazon web services installation Guide

Digitalocean installation Guide

Microsoft azure installation Guide

Softlayer setup Guid

Use docker cloud to proxy your host

If you are running in cluster mode, please continue to read the following.

Create a cluster

If you are using amazon web services (aws), you can automatically create a cluster on aws.

If you are using microsoft azure, you can automatically create a cluster on azure.

Otherwise, in docker cloud ui, run the docker swarm init and docker swarm join commands through docker cloud. Finally, by clicking "enable swarm mode" at the top of the screen, and.

Enable swarm mode

Deploy applications on cloud providers

First connect to your cluster through docker cloud, from the web interface of docker cloud in cluster mode, select "swarms" at the top of the page, click the cluster you want to connect to, and then copy and paste the given command into the command line terminal.

Or, on docker for mac or docker for windows, you can pass.

Either way, a terminal will open with the context of your local machine, but its docker commands will be routed to the cluster running on your cloud service provider. You can directly access the local file system and remote clusters, enabling pure docker commands.

Run docker stack deploy-c docker-compose.yml getstartedlab to deploy the application on a cloud-managed cluster.

$docker stack deploy-c docker-compose.yml getstartedlab

Now your application is running on your cloud provider.

Run some commands to verify the deployment

You can use the swarm command to browse and manage the cluster, such as using docker node ls to list nodes:

$docker node ls

Use docker service ls to list services:

$docker service ls

Use docker service ps to view the tasks of the service:

$docker service ps vy7n2piyqrtr

Open service ports on the machines of cloud providers

At this point, your application will be deployed as a cluster on the cloud provider server, as proved by the docker command you just ran, but you still need to open the port on the cloud server to:

Allows communication between redis services and web services on the worker node.

Allow inbound traffic to the web service on the worker node to access hello world and visualizer from the web browser.

Allow inbound ssh traffic on the server running Manager (may have been set up on the cloud provider)

These are the ports that you need to expose for each service:

Servicetypeprotocolportwebhttptcp80visualizerhttptcp8080redistcptcp6379

Iteration and cleanup

Extend the application by changing the docker-compose.yml file and redeploy immediately using the docker stack deploy command. Change the behavior of the application by editing the code, and then rebuild to push the new image. You can also use docker stack rm to clean up the stack, for example:

$docker stack rm getstartedlab

Unlike the scenario where you run a cluster on a local docker virtual machine, your cluster and all applications deployed on it will continue to run on the cloud server, regardless of whether you shut down the local host or not.

At this point, the study on "how to deploy applications with Docker Cloud" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report