How to run docker and docker-compose on Raspbian
Since taganga v2 now uses multiple machines, I want to try if a RPi can help me save a few bucks monthly. So here are the steps to install docker and docker-compose into a RPi with Raspian 9 (cat /etc/os-release
).
Installing Docker
So here we go…
curl -fsSL get.docker.com -o get-docker.sh && sh get-docker.sh
After a looong time hopefully you will have installed docker, now let’s do some last tweaks.
Create a docker group
sudo groupadd docker
Add your user to the docker group you just created
sudo gpasswd -a pi docker
And that’s it, you just have to restart and we’re done. To try it you should be able to run
docker run hello-world
Installing docker-compose
Update your packages
sudo apt-get update
Install almighty python and pip
sudo apt-get install -y python python-pip
And lastly…
sudo pip install docker-compose
And that’s it, you should now be able to run
docker-compose build
in your project.
Have fun!
Main sources:
- https://medium.freecodecamp.org/the-easy-way-to-set-up-docker-on-a-raspberry-pi-7d24ced073ef
- https://withblue.ink/2017/12/31/yes-you-can-run-docker-on-raspbian.html
Docker compose by this method is very out of date (1.8.0).
By default this would also fail on compiling cryptography – I had to run
sudo apt-get install build-essential libssl-dev libffi-dev python-dev
before I could go ahead and do the pip command.
Cool article ? thank for share?
After a clean install on my raspberry Pi, I also had to install libffi-dev using: `sudo apt-get install libffi-dev`. After that, the pip install for docker compose seemed to work.
Thank you for this post, but I have a problem reproducing it. Executing “sudo pip install docker-compose” fails with “Command “python setup.py egg_info” failed with error code 1 in /tmp/pip-build-wQd5dF/pynacl/”
Please make sure to install libffi-dev or your compilation will fail:
sudo apt-get install libffi-dev