How to install and configure Portainer containers, and also create volume in Linux. you must have installed a docker on the machine. you can manage your docker with GUI on Portainer. you can create, stop, restart, pause and also manage cluster containers, etc. you can also attach volume for Portainer container.
How To Install Portainer Web UI For Docker On Linux:
Let’s create a volume for the Portainer container. I have attached the additional disk and mount it on a directory using LVM.
You can also use the below command for volume containers.
docker volume create portainer_data
I have created a directory and LVM then mounted on the folder for Portainer volume.
mkdir portainer_data mount /dev/mapper/vg-lv_vg portainer_data/ mount -a df -Th
you have to pull the Portainer image from the docker hub using the below command.
docker pull portainer/portainer:latest
Now you have the Portainer image, I have used port 8000 to bind it with Portainer container. So. I can access the Portainer with IP and port 8000 from the outside.
docker run -d --name portainer-con --restart unless-stopped -p 8000:9000 -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer
The container created now with container id: ae68db2af6d9 and port 800 binds with the container port 9000.
Add these port in the firewall
firewall-cmd --permanent –add-port=8000/tcp firewall-cmd –reload
Now access the Portainer using a browser and check your docker host machine IP address using ifconfig.
Enter your ip:8000 in the browser.
Put the password minimum of 8 digits and click on create a user.
Now you need to choose your environment where you want to deploy and I’m choosing local and click on connect.
Manage the Docker environment where Portainer is running. Ensure that you have started the Portainer container with the following Docker flag:
-v "/var/run/docker.sock:/var/run/docker.sock"(Linux). or
Click on local and you can see all the information about dockers that are running on your machine.
You can check the container information by clicking on the Container on the left side.
you can also check container statistics using the below command.
docker stats ae68db2af6d9 --no-stream
You’re done configure portainer linux