103Portainer - amagerard/Docker GitHub Wiki
Docker/Home
RedHat/Docker.
1- Docker | 2- Firewall | 3- Portainer | 4- Drupal | 5- Joomla |
---|---|---|---|---|
6-Wordpress | 7-Xwiki | 8- Mediawiki | ||
Casaos | Zimaos |
3.Portainer.
3.1 Portainer.
As it is written on the official website https://www.portainer.io/
Portainer is effortless container management for Docker.
But it's not free.
Home & Student license cost $149/year.
Fortunately there is a free community version Portainer CE.
https://docs.portainer.io/start/install-ce/server/docker
3.2 Check these ports are unused.
You can only install a container if its port is free.
Portainer uses ports 8000, 9000 and 9443.
To see the used ports.
netstat -plnt
tcp 0 0 0.0.0.0:8082 0.0.0.0:* LISTEN 1669/docker-proxy
tcp 0 0 0.0.0.0:8081 0.0.0.0:* LISTEN 1679/docker-proxy
tcp 0 0 0.0.0.0:33772 0.0.0.0:* LISTEN 1642/docker-proxy
tcp 0 0 0.0.0.0:33771 0.0.0.0:* LISTEN 1663/docker-proxy
In this example, these ports 8081, 8082, 33771 and 33772 are used.
3.3 Portainer installation.
This procedure is based on this example.
Docker server ip :192.168.60.55/24
Your username: teacher
Your home directory:/home/teacher
docker volume create portainer_data
Search for the latest version of Portainer-ce.
https://hub.docker.com/r/portainer/portainer-ce/tags
At 1 December 2024 this is version 2.21.0.
2.21 is the first Long Term Support, or "LTS", release of Portainer.
docker run -d -p 8000:8000 -p 9000:9000 -p 9443:9443 --name portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:2.21.0
3.4 Open Portainer with your browser.
Add this rule to the firewall.
ufw allow in from any to any port 9000
http://192.168.60.55:9000
username: admin
The password must be at least 12 characters long.
Create user.
Get Started
Clic on local Environments.
At the left, you have :
- Containers.
- Images.
- Networks.
- Volumes.
3.5 How to use Portainer.
The administration of containers with Docker is command line.
All command lines start with Docker ....
I use the Portainer application only for:
- Start, stop, edit, remove a container.
- Remove Images.
- Create or remove networks.
- Create or remove volumes.
3.6 Naming convention.
This is my naming agreement.
If I have several containers, it's very difficult for me to navigate.
3.6.1 Containers' name.
The name will be of the form cnt_ [app] _ [type] _ [number]
Example:
Drupal needs the drupal and mariadb container.
App gives dpl
(3 Characters) for Drupal.
Type gives wb
for HTML and db
for database.
Number is instance 1 for drupal.
cnt_dpl_wb_1
is container 1 for Drupal html.
cnt_dpl_db_1
is container 1 for Drupal database.
The 2 containers number 1 are together.
3.6.2 Networks'name.
The default network is bridge.
The issue is that all containers will be on the same network.
I chose to create a network for each container that will be together.
The name will be of the form net _ [app] _ [number]
Example:
Drupal needs a network.
App gives dpl
(3 characters) for Drupal.
Number is instance 1 for Drupal.
net_dpl_1
is the network for Drupal.
3.6.3 Volumes'name.
The volume is the place where is stored:
- html
- database
By default the volumes are created on:
/var/lib/docker/volumes
The name will be of the form vol_ [app] _ [type] _ [number]
Example:
Drupal needs the drupal and mariadb volume.
App gives dpl
(3 characters) for Drupal.
Type gives wb for html and db for database.
Number is instance 1 for drupal.
vol_dpl_wb_1
is container 1 for Drupal html.
vol_dpl_db_1
is container 1 for Drupal database.
The 2 containers number 1 are together.
3.7 Container logs.
Open Portainer.
In my example,Docker IP server is 192.168.60.55
.
http:192.168.60.55:9000
Click on local Environments.
At the left, you have :
- Containers.
- Images.
- Networks.
- Volumes.
Select Container.
Choose your container.
Example : cnt_wps_wb_1
You have "Quick Actions" with 5 items.
- logs
It's for me. - inspect
For advanced users. - stats
For stats lovers. - exec Console
Don't use. - Attach console
Don't use.
The logs, give you messages when everything is going wrong or when everything is going well.
Example:
- for a web type container, you have when everything goes well.
Command line: 'apache2 -D FOREGROUND'
- for a db type container, you have when everything goes well.
socket: '/run/mysqld/mysqld.sock' port: 3306 mariadb.org binary distribution