Install Docker in Debian 11 VM
Install Debian
How-to? WIP
Install Docker and docker-compose
Always update the system:
1
| sudo apt update && sudo apt upgrade
|
Install needed packages.
1
2
3
4
5
6
| sudo apt install -y \
apt-transport-https \
ca-certificates \
curl \
gnupg \
lsb-release
|
Get key to authenticate docker repo.
1
2
| sudo curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
|
Add docker repo.
1
2
3
| sudo echo \
"deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
|
Run repo update
Install docker.
1
| sudo apt install -y docker-ce docker-ce-cli containerd.io
|
Check docker is running.
1
| sudo systemctl status docker
|
Allow docker to run without root privileges.
1
| sudo usermod -aG docker $USER
|
Log Out then Back In and test docker
Install docker-compose
1
2
3
4
5
| sudo curl -L "https://github.com/docker/compose/releases/download/v2.5.1/docker-compose-linux-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
docker-compose -v
|
Download the package cifs:
1
| sudo apt install cifs-utils -y
|
Store the user credencial on root:
1
2
3
4
| nano /root/.smbcredentials
username=username
password=password
|
Edit fstab to add mount point to the boot:
Add line to fstab:
1
| //10.8.0.188/media /media/media cifs uid=1000,gid=1000,credentials=/root/.smbcredentials
|
Mount the shared folder
**Install local-persist plugin for docker
1
| curl -fsSL https://raw.githubusercontent.com/MatchbookLab/local-persist/master/scripts/install.sh | sudo bash
|
Mounting NFS share
Install NFS
1
| apt -y install nfs-common
|
Create mount directory
Test mount the shared folder,
1
| mount -t nfs 10.10.0.10:/backups /var/backups
|
Add the mount to the boot, edit /etc/fstab
1
| 10.10.0.10:/backups /var/backups nfs rw
|
If not mounted before you can use the follow command: