Files
org-roam/20230523145313-portainer_docker.org
2025-11-05 09:18:11 +01:00

26 lines
2.4 KiB
Org Mode
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
:PROPERTIES:
:ID: 4afb1f41-983a-4b54-9828-a1e3788eb28b
:END:
#+title: portainer-docker
Portainer Community Edition is a lightweight service delivery platform for containerized applications that can be used to manage [[id:df046fd7-1f82-4e12-9065-56d222f56408][docker]], Swarm, Kubernetes and ACI environments. It is designed to be as simple to deploy as it is to use. The application allows you to manage all your orchestrator resources ([[id:936191f2-696b-4d9a-96ad-c8449778ae26][containers]], images, volumes, [[id:9d04fac3-89ae-4a96-b326-9ae7e2c22118][networks]] and more) through a smart GUI and/or an extensive API.
Portainer consists of a single container that can run on any cluster. It can be deployed as a [[id:5fada795-19a3-4ba6-97c0-0b70bd728a2f][Linux]] container or a Windows native container.
This container is deployed to oversee all deployed docker containers. You can create the container with the following commands:
#+begin_src bash
docker volume create portainer_data
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
#+end_src
* Multiple [[id:f2b1d5af-1a7d-47a5-95c8-4a85d558419e][server]]
Portainer can be used to manage multiple instances of docker (servers). For that to be possible a second portainer container has to be deployed on the machine that is added to the main portainer manager. [[id:673d1cb1-536b-42f1-a046-40a8937c4283][root]] priv. needed ([[id:dc54334e-afa9-4a53-be91-1e90bc6bf8d0][sudo]]).
#+begin_src bash
sudo docker run -d -p 9001:9001 --name portainer_agent --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/docker/volumes:/var/lib/docker/volumes portainer/agent
#+end_src
For that to work, the port has to be accessible from the main portainer instance. After the conatiner is spawnd, access the additional instance through the portainer [[id:a08570b0-8fe8-45a8-8f60-e45ea6b31a34][GUI]] on port 9000 and add it via the environment tab as a swarm instance.
* Stacks
Portainer has a feature for controlling Docker Stacks (multiple containers that act as a complementary unit). To do that, the containers need to be started as a stack inside the portainer UI. This must be done as a docker compose file. Thzis file can be either created in portainer or imported from different sources. you can controll all containers in a stack at the same time to stop/start the whole unit.