Quick News Bit

How to deploy a container to a remote Docker machine with ServerCat

0

Find out how ServerCat makes it easy to deploy a container to one or more Docker hosts with batch execution.

Shipping containers in the shape of a docker whale.
Image: Sergey Novikov/Adobe Stock

ServerCat is one of my favorite tools for remotely accessing and monitoring Linux servers. With a beautifully designed UI and user-friendly structure, anyone can use this tool to access remote Linux servers.

But ServerCat has a few other tricks up its crafty sleeve. One such trick is the ability to batch-execute Docker deployments to any supporting server you have connected. With a single command, you can deploy containers to all of your Docker servers and then monitor them to make sure they’re running as expected. I’ll show you how simple it is to do just that by batch-deploying an NGINX container to multiple servers hosting Docker containers.

SEE: Hiring kit: Back-end Developer (TechRepublic Premium)

What you’ll need to deploy a container with ServerCat

You’ll need ServerCat installed on a macOS device, and at least one Linux host connected that runs Docker.

How to deploy a container with ServerCat

Before we get into this, know that deploying a container with ServerCat isn’t totally a point-and-click affair, because you will need to know how to deploy that container via the command line. I will demonstrate an NGINX container deployment, which is relatively simple.

The first thing to do is open ServerCat on your macOS device. From the main window, you should see the Execute entry in the left navigation (Figure A).

Figure A

ServerCat offers a very clean and simple to use UI.
ServerCat offers a very clean and simple to use UI.

In the Execute screen (Figure B), you’ll see a list of all the available hosts at the top, the execute command field, and the Execute button.

Figure B

The ServerCat Execute window allows you to batch-execute to any server.
The ServerCat Execute window allows you to batch-execute to any server.

This isn’t only used for deploying containers; you could also, say, run sudo apt-get upgrade -y on any Ubuntu-based server. But for this demonstration, we’ll deploy a container.

At the top, select all of the Docker servers to which you want to deploy the container. Next, in the Execute Command field, type:

docker run --name docker-nginx -p 8080:80 -d nginx

With everything set (Figure C), click Execute to deploy the container to the selected hosts.

Figure C

Deploying NGINX to two Docker servers at once.
Deploying NGINX to two Docker servers at once.

As you can see in Figure D, one deployment succeeded, while the other did not.

Figure D

A failed deployment and a successful deployment.
A failed deployment and a successful deployment.

If I go to Hosts and then double click the Docker Swarm entry, I can run docker ps -a to discover port 8080 is already taken, which caused the error (Figure E).

Figure E

Our problem has been spotted.
Our problem has been spotted.

Then, I can attempt another deployment using a different external port with the command:

docker run --name docker-nginx2 -p 8081:80 -d nginx

We have to rename docker-nginx to docker-nginx2 because the first name is already taken. That command will succeed, and our NGINX container will be deployed to our Docker Swarm host.

Simple Docker deployment

Although ServerCat container deployment isn’t a full-on point-and-click affair, it does make it easy to spin up containers on multiple remote Docker nodes and then monitor those containers. If you know the basics of Docker CLI deployment, ServerCat will help make the deployment and monitoring of those containers a bit easier. Give this all-in-one tool a try, and see if it doesn’t become your go-to means of batch-executing containers to your Docker servers.

Continue your IT education with this The Linux & Docker Coding Bundle from TechRepublic Premium.

Subscribe to TechRepublic’s How To Make Tech Work on YouTube for all the latest tech advice for business pros from Jack Wallen.

For all the latest Technology News Click Here 

 For the latest news and updates, follow us on Google News

Read original article here

Denial of responsibility! NewsBit.us is an automatic aggregator around the global media. All the content are available free on Internet. We have just arranged it in one platform for educational purpose only. In each content, the hyperlink to the primary source is specified. All trademarks belong to their rightful owners, all materials to their authors. If you are the owner of the content and do not want us to publish your materials on our website, please contact us by email – [email protected]. The content will be deleted within 24 hours.

Leave a comment