Raspberry Pi: Docker & Portainer - msandholz/RaspberryPi-Tutorials GitHub Wiki
-
Login with SSH 2a. Download Docker with:
pi@octopi:~ $ curl -sSL https://get.docker.com
2b. Install Docker with:pi@octopi:~ $ sh get-docker.sh
2c. Run Docker as non-Root user:pi@octopi:~ $ sudo usermod -aG docker pi
2d. Check Group:pi@octopi:~ $ groups pi
-
Enable Docker as service:
pi@octopi:~ $ sudo systemctl enable docker
-
Start Docker:
pi@octopi:~ $ sudo systemctl start docker
-
Request Docker status:
pi@octopi:~ $ sudo systemctl status docker
● docker.service - Docker Application Container Engine Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled) Active: active (running) since Fri 2021-01-08 16:22:22 GMT; 3min 18s ago Docs: https://docs.docker.com Main PID: 17944 (dockerd) Tasks: 13 CGroup: /system.slice/docker.service └─17944 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
-
Docker command line reference: https://docs.docker.com/engine/reference/commandline/cli/
-
List all installed Docker containers:
pi@octopi:~ $ sudo docker container ls --all
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 9a76ff637b20 portainer/portainer "/portainer" 29 minutes ago Exited (2) 8 minutes ago portainer
-
Stop one or more running containers:
pi@octopi:~ $ sudo docker container stop portainer
-
Start one or more stopped containers:
pi@octopi:~ $ sudo docker container start portainer
Pre-requirements: Docker is installed!
-
Login with SSH
-
Create volume with:
pi@octopi:~ $ sudo docker volume create portainer_data
-
Install Portainer with:
pi@octopi:~ $ sudo docker run -d -p 8000:8000 -p 9000:9000 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce
-
Access Portainer in browser:
http://<ip-adress>:9000
-
Create new password
-
Click on Local and hit the Connect-Button
-
Click on Container List
-
Add new Container
hello world
- click on Add Container
- fill in Name
my-first-container
and Docker.io imagehello-world
- click on deploy the container
-
Update Portainer
- get latest version:
pi@octopi:~ $ sudo docker pull portainer/portainer
- stop portainer:
pi@octopi:~ $ sudo docker stop portainer
- remove portainer:
pi@octopi:~ $ sudo docker rm portainer
- run new version of portainer:
sudo docker run -d -p 8000:8000 -p 9000:9000 --name Portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:latest
- get latest version: