Portainer Docker

Portainer docker is an excellent tool for managing Docker containers across multiple platforms. It is simple to install on any Linux distribution, and its web-based GUI front-end is extremely user-friendly. We may write detailed articles on portainer’s various features in the future, but for now, we’ll learn how to install and configure portainer in Linux.

How to install Portainer in Ubuntu?

Before pulling portainer to our system, install Docker in your system. You can use your distribution package manager to install docker in your distro.

First of all, update your system.

sudo apt update sudo apt upgrade

Install Docker

sudo apt install docker.io

Install portainer

sudo docker volume create portainer_data

docker run -d -p 8000:8000 -p 9443:9443 –name portainer –restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:latest

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

Install Portainer in Manjaro or Arch Linux

You can follow the above method to install portainer in Manjaro. But portainer is also available in the Arch User Repository and it’s build is regularly updated with the latest release. Portainer is available in the Arch User Repository so you can easily install portainer in Manjaro or Arch Linux. Arch

sudo pamac build portainer-bin

And that is it. Now portainer is installed and running on port 9000. To access the dashboard, visit 127.0.0.1:9000 in your browser. When you visit 127.0.0.1:9000 for the first time, it will redirect to create a user. Enter the username, strong password and click “Create user”. The next step is to connect to the Docker environment. You can connect portainer with a remote server, Microsoft Azure server, or connect to a portainer agent. In this example, we will connect our local and remote docker environment with portainer. Mostly we do not have to do anything to connect to our local environment. Just select the local environment and click Connect and portainer will automatically configure and connect to the local environment. Select “Local” and click “Connect”. You have connected portainer with the local Docker environment. You can now manage the docker environment with this easy-to-use application. Click on the connection “local” and it gets to the dashboard.

Connect Portainer Docker With Remote Docker Environment

It was simple to connect to the local docker environment. However, before we can connect to our remote docker environment, we must first configure a few things on the remote docker server.

Expose Remote Docker Api

We need to expose our remote docker API in order to connect to it. Using SSH, connect to your remote server. Once logged in, create the configuration at /etc/systemd/system/docker.service.d/remote-api.conf.

sudo nano /etc/systemd/system/docker.service.d/remote-api.conf

Now paste the following in the file –

[Service] ExecStart= ExecStart=/usr/bin/dockerd -H tcp://0.0.0.0:2375 -H unix://var/run/docker.sock

Now press Ctrl + O to save the file and Ctrl + X to exit. Take note of the port number 2375, which will be used to connect to this docker from portainer.

sudo systemctl daemon-reload

sudo service docker restart

or

sudo systemctl restart docker

Now the configuration part is done. Open portainer in the web browser, click Endpoints from the sidebar, and Add environment. Select Docker from the Environment type. Now fill all the required environment details.

Name: The environment name to show on the dashboardEnvironment URL: The IP address of your remote server with the port we configured on the remote server. i.e. 192.168.29.34:2375.

If you want to use TLS, then toggle it on and upload the certificates. Rest of the fields are optional. Finally, click Add environment. If your remote server is configured as show above, you’ll see the success message. From the dashboard, you can see and manage the number of stacks, containers, images, volumes, and networks. One of the most useful features of Portainer is that you can easily launch a docker app. There are various app templates available that you can use to launch your application on docker. To create the app, go to “App Templates” and click on the app you want to launch. As you can see below, creating an app is very easy. Just select the app, fill in the details, and hit Deploy. Currently, portainer has 41 app templates available. These templates include CMS, DBMS, web servers, file manager, registry manager, and many more.

Conclusion

Docker is a useful tool for developers, and portainer makes it extremely simple to use. In subsequent articles, I will go over more portainer features in depth. If you have any questions about any of the above steps, please leave them in the comments section below.