Getting Started with Docker (Linux)
For this project I really start from scratch and describe each step as clearly as I can.
After all, this blog series should also become my project documentation...
If it helps someone else as well, then this is a nice side effect.
Provisioning a Docker Host System:
Download ISO:
- debian-10.2.0-amd64-netinst.iso
Reference: https://www.debian.org/distrib/netinst
Why choosing debian?
- simply because it is the base for several other Distris, including the two most popular desktop Linux Ubuntu and Mint.
- because Linux is the most used OS hosting websites and wbapplications
Reference: https://w3techs.com/technologies/details/os-linux
VM- and Operating System Provisioning:
Remarks:
If some settings doesn't fit to your needs choose different settings
<value> - placeholder for a custom value
Steps:
- Create VM -
I am using a VMware ESXi host, but any other virtualization platform should work as well
- Boot the operating system from the installation media
- Select graphical installation option -
Graphical Install
- Select language -
English
- Select Location -
other
,Europe
,Austria
,en_US.UTF-8
- Select the keyboard layout -
German
- Define Hostname -
<Hostname - e.g. "DOCKSRV">
- Define domain -
<Domain - e.g. ".organisation.local">
- Root Passwort -
<root password>
- Additonal User Name -
<Name - e.g. "Max Mustermann">
- Additonal User ID -
<ID - e.g. "mmuster" >
- Additonal User Passwort -
<user password>
- Partition Disks -
Use entried Disk and set up LVM
,All Files in one partition
,max
- Configue Packet Manager -
Austria
,debian.sil.at
- Popularity-Contest -
No
- Software Selection -
SSH server
,standard system utilities
- Grub Boot Loader -
Yes
,/dev/sda
Configure the SSH server:
- Edit configuration file with "Nano" -
nano /etc/ssh/sshd_config
# Authentication: LoginGraceTime 120 #PermitRootLogin without-password PermitRootLogin yes StrictModes yes
- Restart SSH service -
service ssh restart
Configuring the network interface:
- Edit configuration file with "Nano -
nano /etc/network/interfaces
#Loopback Interface auto lo iface lo inet loopback # Ethernet Schnittstelle allow-hotplug ens32 iface ens32 inet static address <xxx.xxx.xxx.xxx> netmask <xxx.xxx.xxx.xxx> gateway <xxx.xxx.xxx.xxx> dns-nameserver <xxx.xxx.xxx.xxx> dns-nameserver <xxx.xxx.xxx.xxx>
- Package list update -
apt-get update
- Install Resolvconf -
apt-get install resolvconf
- Restart network -
service networkin restart
- Start network interface -
ifup ens32
- Retrieving network information -
ip ad
Install Docker:
- Install dependency packages -
apt -y install apt-transport-https ca-certificates curl gnupg2 software-properties-common
- Add Docker’s official GPG key -
curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add -
- Add the Docker repository to Debian 10 -
add-apt-repository \ "deb [arch=amd64] https://download.docker.com/linux/debian \ $(lsb_release -cs) \ stable"
- Package list update -
apt-get update
- Install Docker -
apt -y install docker-ce docker-ce-cli containerd.io
- Checking the status -
sudo systemctl status docker
Installing Docker - Compose:
- Download the latest Compose -
curl -s https://api.github.com/repos/docker/compose/releases/latest \ | grep browser_download_url \ | grep docker-compose-Linux-x86_64 \ | cut -d '"' -f 4 \ | wget -qi -
- Make the file executeable -
chmod +x docker-compose-Linux-x86_64
- Move the file to the user path -
mv docker-compose-Linux-x86_64 /usr/local/bin/docker-compose
- Make the file executeable -
- Confirm version -
docker-compose version
Configure Compose Command-line completion
- Download the latest Compose -
curl -L https://raw.githubusercontent.com/docker/compose/master/contrib/completion/bash/docker-compose -o /etc/bash_completion.d/docker-compose
- Source the file or re-login to enjoy completion feature -
source /etc/bash_completion.d/docker-compose
Install Portainer (Docker Management Interface)
- Create a persistent Volume -
docker volume create portainer_data
You will find it here:/var/lib/docker/volumes
- Running Portainer with Docker
# Old Way:
docker run -d -p 9000:9000 --name portainer --restart always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer
# New Way:
docker run -d -p 8000:8000 -p 9000:9000 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce
Result:
Reference:
- https://computingforgeeks.com/install-docker-and-docker-compose-on-debian-10-buster/
- https://computingforgeeks.com/how-to-install-latest-docker-compose-on-linux/
- https://computingforgeeks.com/install-docker-ui-manager-portainer/
- https://averagelinuxuser.com/debian-9-installation-guide/
- https://averagelinuxuser.com/linux-swap/
- https://averagelinuxuser.com/debian-10-install/
- https://blogs.itemis.com/de/vorsicht-bei-experimenten-mit-docker-im-internet
- https://docs.docker.com/install/linux/docker-ce/debian/#install-using-the-repository
- https://docs.docker.com/compose/install/
- https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-debian-10
- https://medium.com/@vijayvikram11844/portainer-to-manage-docker-4a30944ddb99