11/24/2021»»Wednesday

Rpi Docker Install

So, you've just gotten your raspberry pi, I know I just did at least, and you want to set it up with docker so you can bring all of your favorite applications to this powerful piece of technology. Well then you're in the right place I'll be showing you how to setup raspberry pi with docker using raspbian os

Docker

Step 5: Install Docker on Raspberry Pi. In this step we’ll finally be getting to the fun stuff, installing the Docker Engine. Update your system again now that we have added a new repository! Sudo apt update sudo apt-get install docker-ce docker-ce-cli containerd.io.

So I’ve customised a GParted LiveCD ISO and written up a custom script to.hopefully. install a distro straight onto an SD card. This is a very early iteration of this idea, but hopefully will develop into something useful. At the moment, essentially what it will do is 1. Grab the list of Distros from the RPI Download page; 2. Install Docker-Compose. Docker-Compose usually gets installed using pip3. For that, we need to have python3 and pip3 installed. If you don't have it installed, you can run the following commands: sudo apt-get install libffi-dev libssl-dev sudo apt install python3-dev sudo apt-get install -y python3 python3-pip. The first step is to install Home Assistant. We recommend a dedicated system to run Home Assistant. If you are unsure of what to choose, follow the Raspberry Pi guide to install Home Assistant Operating System. Home Assistant offers four different installation methods. We recommend using one of the following two methods. We were eager to test and use Docker in our Raspberry Valley makerspace. This document describes how to setup a base image for your Docker experiments. While working with Docker images and containers on an ARM device still has some issues to handle as opposed to mainstream hardware, the installation of a bare-bones machine with Docker on top is quite straightforward.

Updating your raspberry pi

To start off update your raspberry pi to the latest version using the following command

The following command simply updates your raspberry pi to the newest version that way you won't have any issues. The command can take a couple minutes to an hour or so depending on your network speed and how much you have to update

When you run the command the output should look something along the lines of this

Downloading docker

After you've updated your raspberry pi it's time to install docker, once again it's quite simple to do so just run the command

which will get the docker install script for docker if you want to run the test branch of docker use the command

You can verify that you've downloaded the script by running ls and verifying the output shows either get-docker.sh or test-docker.sh

Once the file is downloaded you want to run it. Execute the script by running the following command

Now if it does not run the script you will have to run sudo chmod +X ./get-docker.sh This just gives the script the E(x)ecute tag hence the +. Afterward, re-run get-docker.sh

It will then attempt to install docker automatically for you, you can for the most part safely ignore all the stuff that comes up in the terminal as it's just the command it's doing

The output looks something like this

Verifying the install

Once the command is done running you can verify that docker is installed by running

Which should return something along the lines of this

If it returns -bash: docker: command not found restart your raspberry pi and attempt to run the command again. If it still doesn't work run the install script again

Next up we'll be going through how to make docker work without adding sudo first, if you're not interested in that you can skip over that section and move straight to Hello-World

Docker Install Ubuntu

Rpi Docker Install

To make docker run without root you need to create a user group to access the docker container you can do such by running the following command

Rpi Docker Install

replace <user> with your username which by default is pi
For the changes to take effect you have to log out and log back into your account or you can optionally run this command

Once again replace <user> with your username

For the sake of tutorial, I'll just be running the reboot command which restarts the raspberry pi

Note: if you decide to do it this way you have to ssh into your raspberry pi again

As with all programming languages or tools nowadays the first thing you do is Hello World so let's get to it

Installing Docker On Rpi

To run the hello world docker container simply write

If all is well it should return this

and that's it. Well done! now you're well on your way to learning docker

Setting up docker-compose (optional)


So the new standard nowadays is setting up docker containers using docker-compose

Since the docker install doesn't come with this you have to install this manually

Installing python3

Raspberry Pi Docker Install Portainer

To run docker-compose you need python3You can get it by running the following commands

Installing docker-compose

Rpi Docker Install Python

After you've installed the dependencies above you can install using pip3 by running this command

Rpi Docker Installation

Install

Rpi Docker Install

and that's it now you can use docker-compose in addition to docker! Here's me attempting to setup pi-hole using docker-compose

Most Viewed Posts