Installing Docker Swarm on Fedora CoreOS Latest

Prerequisites

Step 1: Install Docker on Fedora CoreOS

Before installing Docker Swarm, you need to install Docker on Fedora CoreOS. Follow the below instructions to do that:

  1. Connect to your Fedora CoreOS instance via SSH.

  2. Run the following command to install Docker:

sudo yum install docker
  1. Start and enable Docker with the following commands:
sudo systemctl start docker
sudo systemctl enable docker
  1. Check if Docker is running by entering the following command:
sudo systemctl status docker

Step 2: Initialize Docker Swarm

Once you have installed Docker, you need to initialize the Docker Swarm. Follow the below instructions to do that:

  1. Start Docker Swarm with the following command:
sudo docker swarm init
  1. You should see output similar to the following:
Swarm initialized: current node (dqg556dtcyt1n8t2cmrf9mvnw) is now a manager.

To add a worker to this swarm, run the following command:

    docker swarm join --token SWMTKN-1-0hh2gxxxxxxxxxxxxxxxxx    192.168.99.101:2377

To add a manager to this swarm, run 'docker swarm join-token manager' and follow the instructions.
  1. Note down the token that is displayed in the output as you will need it to join other nodes to the Swarm.

Step 3: Deploy Your First Service

Now that you have initialized Docker Swarm, you can deploy your first service. Follow the below instructions to do that:

  1. Create an NGINX service with the following command:
sudo docker service create --replicas 3 --name nginx-service nginx
  1. Check the status of the service with the following command:
sudo docker service ls
  1. You should see output similar to the following:
ID                  NAME                MODE                REPLICAS            IMAGE               PORTS
lh2js8vtq3r3        nginx-service       replicated          3/3                 nginx:latest

Step 4: Scaling Your Services

One of the main benefits of Docker Swarm is the ability to scale services up and down. Follow the below instructions to scale your services:

  1. Scale up the NGINX service to 5 replicas with the following command:
sudo docker service scale nginx-service=5
  1. Check the status of the service with the following command:
sudo docker service ls
  1. You should see output similar to the following:
ID                  NAME                MODE                REPLICAS            IMAGE               PORTS
lh2js8vtq3r3        nginx-service       replicated          5/5                 nginx:latest

Conclusion

In this tutorial, you have learned how to install Docker Swarm on Fedora CoreOS and deploy and scale services. You can now experiment with deploying different services and scaling them to meet your needs.

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!

Alternatively, for the best virtual desktop, try Shells!