Hi, in this post we will install Docker on Raspberry Pi and Portainer to manage our container using any web browser from another computer. Docker ables to us to install/uninstall tons of softwares with a simple command.
Installing Docker
First of all, lets install all prerequisites:
sudo apt-get install apt-transport-https ca-certificates software-properties-common -y
Now, we can install Docker:
curl -fsSL get.docker.com -o get-docker.sh && sh get-docker.sh
After Docker installation, lets put pi user on Docker group to run commands without sudo:
sudo usermod -aG docker pi
To keep docker update, lets add Docker repository Raspberry Pi OS:
- Import Docker CPG key
-
sudo curl https://download.docker.com/linux/raspbian/gpg
-
- Edit repository sources to add Docker Repo
sudo nano /etc/apt/sources.list
- Add the following line:
deb https://download.docker.com/linux/raspbian/ stretch stable
- Press Ctrl+X and Enter to save the file
- Press Y to confirm
- Run
sudo apt-get update
- Run
sudo apt-get upgrade
- To start Docker, run
sudo systemctl start docker.service
- To ensure that Docker will start on boot, run
sudo systemctl enable docker.service
Install Portainer
To install Portainer:
- Create portainer Docker volume with command
docker volume create portainer_data
- Run the command bellow to create Portainer container:
docker run -d -p 9000:9000 \
--name portainer \
--restart unless-stopped \
-v /var/run/docker.sock:/var/run/docker.sock \
-v portainer_data:/data portainer/portainer
--restart unless-stopped
will configure the container to aways start unless receive a stop command
You can check check the container running just typing docker ps
on the command line. To access Portainer, use any browser like Chrome or Firefox and type your Raspberry IP address and use port 9000, in my case http:192.168.15.26:9000
In your first access, configure your username and your password and click on Create User:
In the next screen, choose the Local option and click on Connect:
Thats it! Your Portainer is configured to manager your container:
Clicking on the first option, or typing on the URL http://YOUR_IP_ADDRESS:9000//#/dashboard
, you can see curious informations about your Docker environment
That’s it for now. Based in this configuration, we will do cool thing to automate your house using on the future the Home Assistant as Docker Container. Bye!