Skip to content

Instantly share code, notes, and snippets.

@pablodz
Last active June 17, 2023 20:58
Show Gist options
  • Save pablodz/daa8ff298663cc4f88cf2cfc966bbede to your computer and use it in GitHub Desktop.
Save pablodz/daa8ff298663cc4f88cf2cfc966bbede to your computer and use it in GitHub Desktop.
Install Docker in Ubuntu 21.10, Install Dockercompose on Ubuntu 21.10
# [🟨OPTIONAL] Uninstall old docker versions
sudo apt-get remove docker docker-engine docker.io containerd runc
# Refresh latest version
sudo apt-get update
# Install pre-req
sudo apt-get install -y \
apt-transport-https \
ca-certificates \
curl \
gnupg \
lsb-release
# Add docker official GPG key
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
# x86 and amd_64 HERE WE CHANGE
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
# Install docker
sudo apt-get update
sudo apt-get install -y docker-ce docker-ce-cli containerd.io
# Give docker permissions
sudo groupadd docker
sudo usermod -aG docker $USER
newgrp docker
# Check version
docker --version
# Check if installed
sudo docker run hello-world
# If still fails, reboot OS
# Downloand docker compose stable
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
# Apply executable to binary
sudo chmod +x /usr/local/bin/docker-compose
# Check version
docker-compose --version
@ninogresenz
Copy link

thanks a lot! 👍

@pablodz
Copy link
Author

pablodz commented Oct 22, 2021

Thank you guys, that's fuel to keep doing things to solve problems

@slavafomin
Copy link

Thank you, sir! By the way, what is exactly wrong with the official instructions?

I was getting Unable to locate package docker-ce-cli.

@pablodz
Copy link
Author

pablodz commented Oct 22, 2021

Thank you, sir! By the way, what is exactly wrong with the official instructions?

Docker doesn't have release for impish ubuntu yet. So, we force hirsute version inline 17

I was getting Unable to locate package docker-ce-cli.

Maybe this will helpful https://unix.stackexchange.com/a/363058

@JinxedDev
Copy link

Thanks you!

Also if you are running on a Raspberry Pi 4 I found I also had to install the linux-modules-extra-raspi package to get it working.

@Rho-bur
Copy link

Rho-bur commented Oct 26, 2021

It work, thank you @pablodz !

@francois-le-ko4la
Copy link

Thx a lot for explanations and details.
Thx @JinxedDev I did your fixe and now all is fine.

@pablodz
Copy link
Author

pablodz commented Nov 2, 2021

Now, Docker supports ubuntu 21.10

I changed the script to

 echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

https://docs.docker.com/engine/install/ubuntu/

@abedcodes
Copy link

very helpful thank you very much :)

@blastermaster
Copy link

thank you!

@antonioroque200OK
Copy link

Right on! Worked just fine! Thank you very much!!

@jonasrosland
Copy link

Thank you for this quick writeup!

@nvictorme
Copy link

Such a lifesaver! Thanks @pablodz 🏆

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