Browse Source

Update 'Docker.md'

master
cse44742 3 years ago
parent
commit
fc4ee19159
  1. 44
      Docker.md

44
Docker.md

@ -2,15 +2,15 @@
Firstly, you need to update your OS else they may occur problems during installations. Firstly, you need to update your OS else they may occur problems during installations.
``` ```
$sudo apt update $ sudo apt update
$sudo apt upgrade $ sudo apt upgrade
``` ```
##### Fix Network Issues ##### Fix Network Issues
``` ```
$sudo su $ sudo su
// Delete auto-generated files // Delete auto-generated files
#rm /etc/resolv.conf || true # rm /etc/resolv.conf || true
#rm /etc/wsl.conf || true # rm /etc/wsl.conf || true
//Enable changing /etc/resolv.conf //Enable changing /etc/resolv.conf
//Enable extended attributes on Windows drives //Enable extended attributes on Windows drives
@ -32,31 +32,31 @@ EOF
``` ```
##### Installation of Docker ##### Installation of Docker
``` ```
$sudo -l # To ensure that we can run apt as root $ sudo -l # To ensure that we can run apt as root
$sudo apt install -y lsb-release $ sudo apt install -y lsb-release
$sudo apt install -y curl $ sudo apt install -y curl
$curl -V # Ensure that curl is installed and in a modern version $ curl -V # Ensure that curl is installed and in a modern version
$sudo apt install software-properties-common $ 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 $ 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 \ echo \
"deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian \ "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 $(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 //Add the official repo on apt or any other package manager
$sudo apt install -y docker-ce # Actually installing docker $ sudo apt install -y docker-ce # Actually installing docker
$sudo usermod -aG docker $USER # Add current user to the docker group $ sudo usermod -aG docker $USER # Add current user to the docker group
$su - ${USER} # Reload our shell $ su - ${USER} # Reload our shell
$docker --version # See the docker version $ docker --version # See the docker version
$docker run hello-world # Test if docker really works $ docker run hello-world # Test if docker really works
``` ```
##### Fix "x509: certificate signed by unknown authority" issue ##### Fix "x509: certificate signed by unknown authority" issue
``` ```
$sudo su $ sudo su
#touch set-ca.sh # touch set-ca.sh
registry_address=hub.swarmlab.io registry_address=hub.swarmlab.io
registry_port=5443 registry_port=5443
@ -67,12 +67,12 @@ registry_port=5480
mkdir -p /etc/docker/certs.d/$registry_address:$registry_port 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 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 $ sudo bash ./set-ca.sh
``` ```
##### Docker-Compose ##### 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 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 chmod +x /usr/local/bin/docker-compose
$sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose $ sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
``` ```

Loading…
Cancel
Save