Aproximate time: 45 minutes
What is docker you may ask? Docker is an application that allows you to run microservices/apps in an isolated manner. They are similar to virtual machines, however allow you to use resources more efficiently, they are more portable than a virtual machine as well and rely on the host os more. I am going to show you how to install docker on Ubuntu Server.
Let’s get started:
1 – ssh into your device/vm/RPi
Update the repository and packages
2 – sudo apt update && sudo apt -y full-upgrade
Update this with important server ips, if you don’t have a DNS server.
3 – sudo nano -c /etc/hosts
127.0.0.1 localhost 127.0.1.1 hostname_here ### Docker Swarm on RPi4 ### 192.168.1.140 ohdoc01.cfs.loc ohdoc01 192.168.1.141 ohdoc02.cfs.loc ohdoc02 192.168.1.142 ohdoc03.cfs.loc ohdoc03 192.168.1.143 ohdoc04.cfs.loc ohdoc04
Let’s install all dependencies for docker
4 – sudo apt -y install apache2-utils apt-transport-https ca-certificates curl gnupg2 software-properties-common
5 – sudo curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add –
6 – sudo add-apt-repository “deb [arch=amd64] https://download.docker.com/linux/debian buster stable”
Stor this in a safe place.
7 – sudo htpasswd -nb admin secure_password
8 – cd /var/tmp
9 – sudo curl -fsSL https://get.docker.com -o get-docker.sh <- Download the script to install Docker.
10 – sudo chmod +x get-docker.sh <- Give right persmissionsto the script.
11 – sudo sh get-docker.sh <- Get and install Docker on your Server.
12 – sudo docker version <- Check to if it installed properly
13 – sudo docker info <- Get the docker info.
14 – sudo usermod -aG docker $USER <- Add your user to the Docker Group
Let’s install docker-compose to help deploy apps to the swarm
15 – sudo apt -y install docker-compose
16 – sudo docker-compose -version <- Check the Docker-Compose Version
Stop here if not building a swarm!
On the Master Node you need a place to store your work
17 – sudo mkdir -p projects
18 – cd /projects
19 – mkdir -p your_work_dir_here
If you are creating a swarm you need the following
20 – sudo docker swarm init
Go to the docker worker node and type the following to join the swarm
21 – sudo docker swarm join –token <token_here>
As far as a working docker install you now have one. If you need anymore information please feel free to contact us / me I will be happy to help in anyway I can.
Have a great day and please come back.