Skip to content

Instantly share code, notes, and snippets.

@DiKiyBimer
Last active July 31, 2023 22:40
Show Gist options
  • Save DiKiyBimer/7d6d42504ac12701b9dd257fb7d913ad to your computer and use it in GitHub Desktop.
Save DiKiyBimer/7d6d42504ac12701b9dd257fb7d913ad to your computer and use it in GitHub Desktop.
ForUbuntu20: skipping boring process of find commands with static moves in docker install
#!/usr/bin/env bash
# remove non-official previous installs
for pkg in docker.io docker-doc docker-compose podman-docker containerd runc; do sudo apt-get remove $pkg; done
# remove official previous installs
sudo apt-get update
sudo apt-get purge docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin docker-ce-rootless-extras
sudo rm -rf /var/lib/docker
sudo rm -rf /var/lib/containerd
# Prepare apt-get
sudo apt-get update
sudo apt-get install ca-certificates curl gnupg
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg
echo \
"deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
"$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
# Instal of all important apps
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
systemctl status docker

For IP switching

Many situations by 'unknown' stops of ssh-working

It can be because, your workstation have IP address 172.17.0.0 - 255

So the easiest way - switch a docker IP (if it is not important)

  • Go to:

/etc/docker/ with cd /etc/docker/ next one of sudo nano daemon.json sudo vim daemon.json sudo mc daemon.json

  • or use once:

sudo nano /etc/docker/daemon.json


2.
  • Add to file:
{
  "bip": "YOUR-IP-ADDRESS-HERE",
  "default-address-pools": [
    {
      "base": "YOUR-IP-ADDRESS-HERE",
      "size": XX
    }
  ]
}

Where IP and how it looks

In places with "YOUR-IP-ADDRESS-HERE" add ip in format like 192.168.0.100/24
and part with "size" for XX in this example should have 24

Finally use:

sudo systemctl restart docker

for restart and applying new params

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment