Before installing Docker Swarm, you need to install Docker on Fedora CoreOS. Follow the below instructions to do that:
Connect to your Fedora CoreOS instance via SSH.
Run the following command to install Docker:
sudo yum install docker
sudo systemctl start docker
sudo systemctl enable docker
sudo systemctl status docker
Once you have installed Docker, you need to initialize the Docker Swarm. Follow the below instructions to do that:
sudo docker swarm init
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.
Now that you have initialized Docker Swarm, you can deploy your first service. Follow the below instructions to do that:
sudo docker service create --replicas 3 --name nginx-service nginx
sudo docker service ls
ID NAME MODE REPLICAS IMAGE PORTS
lh2js8vtq3r3 nginx-service replicated 3/3 nginx:latest
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:
sudo docker service scale nginx-service=5
sudo docker service ls
ID NAME MODE REPLICAS IMAGE PORTS
lh2js8vtq3r3 nginx-service replicated 5/5 nginx:latest
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!