DEV Community

DaltonInCloud
DaltonInCloud

Posted on

#100DaysOfCloud | Day 5

What Did I learn -

Oh wow, okay, so today I learned about viewing image history, saving and loading images, this is especially useful when utilizing artifactory for storing your image and then distributing your docker server using Jenkins. As well as the different ways to use tagging, and I learned more about Docker Swarm and that is cool, but I was very happy playing around with Portainer to manage Docker. So for this I first created a volume for my portainer data, then I ran:
docker container run -d --name portainer -p 8080:9000 \
--restart=always \
-v /var/run/docker.sock:/var/run/docker.sock \
-v portainer_data:/data portainer/portainer

After this, I went to my IPAddress at port 8080 and generated a login and got to play around with the Portainer console and I have to say, it was a blast! This may be because I have been so deep in the console the past couple days with little sleep but this was such fun!

What Did I Do -

We finally got to play around with Docker Swarm, yeah!!!!! So, we played around with the network settings, so to do this we created an overlay network with docker network create -d overlay and then we created a service with our overlay network this was accomplished with:
docker service create -d --name <NAME> \
--network <NETWORK> \
-p <HOST_PORT>:<CONTAINER_PORT> \
--replicas <REPLICAS> \
<IMAGE> <CMD>

Then we just add the service to a network with docker service update --network-add <NETWORK> <SERVICE>
But yes, before we can play around with networks in docker swarm we wanted to make our testbed of servers, so we made some worker nodes, then we had to get our worker nodes ready, to do this we pulled the docker repo for our workers:
sudo yum install -y yum-utils \
device-mapper-persistent-data \
lvm2
made sure the repo was stable:
sudo yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo

Then we install Docker on our workers:
sudo yum -y install docker-ce
Enabled start:
sudo systemctl start docker && sudo systemctl enable docker
Added our User to the docker group:
sudo usermod -aG docker <USERNAME>

Once this is complete on the Master Swarm server we initialized swarm manager:
docker swarm init \
--advertise-addr <Server's Private IP>

From hereafter it initializes your CLI should generate a prompt that you can input into all your worker nodes, it looks like this:
docker swarm join --token <TOKEN> \
<PRIVATE_IP>:<PORT>

This was by far one of the coolest dives I have done with docker and I think this is really fun to do for anyone interested and wants to spin up some test servers to play with.

For tomorrow -

What is on the menu for tomorrow? I am not sure, I actually just purchased The Phoenix Project audio book, so I will definately be "cracking that open" sort of speak. Aside from that as promised we are back to the AWS console and on our journey to gain the AWS Dev Associate (This is before we go for the AWS Solutions Architect Professional or the AWS Security Specialty.)

Top comments (0)