##### For an Ubuntu OS: Firstly, you need to update your OS else they may occur problems during installations. ``` $sudo apt update $sudo apt upgrade ``` ##### Fix Network Issues ``` $sudo su // Delete auto-generated files #rm /etc/resolv.conf || true #rm /etc/wsl.conf || true //Enable changing /etc/resolv.conf //Enable extended attributes on Windows drives cat < /etc/wsl.conf [network] generateResolvConf = false [automount] enabled = true options = "metadata" mountFsTab = false EOF //Use google nameservers for DNS resolution cat < /etc/resolv.conf nameserver 8.8.8.8 nameserver 8.8.4.4 EOF ``` ##### Installation of Docker ``` $sudo -l # To ensure that we can run apt as root $sudo apt install -y lsb-release $sudo apt install -y curl $curl -V # Ensure that curl is installed and in a modern version $sudo apt install software-properties-common $curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg # To add the gpg key on our keyring 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 //Add the official repo on apt or any other package manager $sudo apt install -y docker-ce # Actually installing docker $sudo usermod -aG docker $USER # Add current user to the docker group $su - ${USER} # Reload our shell $docker --version # See the docker version $docker run hello-world # Test if docker really works ``` ##### Fix "x509: certificate signed by unknown authority" issue ``` $sudo su #touch set-ca.sh registry_address=hub.swarmlab.io registry_port=5443 mkdir -p /etc/docker/certs.d/$registry_address:$registry_port openssl s_client -showcerts -connect $registry_address:$registry_port < /dev/null | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > /etc/docker/certs.d/$registry_address:$registry_port/ca.crt registry_port=5480 mkdir -p /etc/docker/certs.d/$registry_address:$registry_port openssl s_client -showcerts -connect $registry_address:$registry_port < /dev/null | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > /etc/docker/certs.d/$registry_address:$registry_port/ca.crt $sudo bash ./set-ca.sh ``` ##### Docker-Compose ``` $sudo curl -L "https://github.com/docker/compose/releases/download/1.27.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose $sudo chmod +x /usr/local/bin/docker-compose $sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose ```