**updated 3/14/22 to use docker compose v2**
When i first started to learn how to install docker on raspberry pi, Linux, etc i found many large articles with many steps to tell me how to do it – pages of commands and instructions.
I don’t know why they make it so hard and the ‘received wisdom’ of 5 years ago is still repeated to this day (modern search engines don’t help). I think you will find this simpler, it is the official supported docker way to do this.
Install your preferred linux distro and ssh into it (don’t bother with gui).
For Distros like Debian after you install, login and have root privileges do the following
$ curl -fsSL https://get.docker.com -o get-docker.sh $ sudo sh get-docker.sh $ sudo apt-get install docker-compose-plugin $ sudo service docker start
The great part of doing it this way is you can rerun the script to do updates or even just use apt-update \\ apt-upgrade.,
For OS that doesn’t have python 3 installed by default (for example Raspbian) you need to do a couple of extra steps:
$ curl -fsSL https://get.docker.com -o get-docker.sh $ sudo sh get-docker.sh $ sudo usermod -aG docker pi $ sudo apt-get install docker-compose-plugin
Hope that helps.
Bonus for those who need more of a breadcrumb trail and know how to create VMs but want linux help….
- Download latest Debian ISO (i prefer full install just incase networking gives you grief)
- Create VM
- 2 CPU
- 4GB RAM
- Boot from CD and choose non graphical install of debian with SSH and tools only.
- Create root and yourusername as prompted
- Login as root on console, install basics:
- apt-get update
- apt-get upgrade
- apt-get install nano sudo curl
- Add user to sudo group
- usermod -aG sudo yourusername
- Login via SSH as yourusername and sudo every command from this point forward
- Install docker
- curl -fsSL https://get.docker.com -o get-docker.sh
- sudo sh get-docker.sh
- sudo apt-get install docker-compose
- sudo service docker start