This is a quick post where I demonstrate how to install Portainer on Ubuntu. Regardless this tutorial is demonstrated on Ubuntu, you can run Portainer on whatever Docker host you are using including Windows.
Most awaited Docker Desktop is available for Linux now. Still, it is a desktop application. There is also an alternative that you already might have heard of if you have worked with Kubernetes. It is called Portainer.
If you have not heard of it, you are at the right place. We are going to install Portainer on our local machine to monitor and manage the Docker environment on our local
Benefits of Portainer
- You can manage multiple instances of Docker, including one on your local machine and your servers.
- Provider UI to manage stacks (docker-compose.yml)
Install Portainer on your local machine
You need to have Docker already installed on your system. Head over to installation instruction if you are doubtful.
If you are done with the above setup. You can proceed by running the following command; which is a Portainer image.
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
I hope you can understand the command pretty well as there is no rocket science in it. The important part is
/var/run/docker.sock of the host machine should be available to the portainer container to make changes on behalf of the host machine. We are also using a separate volume called
portainer_data and binding it to
/data in the container.
Wait for the image to download and the container to run. After the process is finished, you’d be returned with the hash of the container.
Use the hash obtained in the last step to find where exactly the container is running in the bridge network.
docker inspect 77d5143780c6e3369dc26e6d6393f6c2a131b2fdb59a5c1256c42972ae552a0f | grep IPAddress
You’d see a something like this:
"SecondaryIPAddresses": null, "IPAddress": "172.17.0.2", "IPAddress": "172.17.0.2",
Use this address to construct a socket. It will be
172.17.0.2:9000 in my case as Portainer runs on port
- User Setup
When you reach that address, you’d see this screen:
- Environment Setup
If you proceed from that screen, you’d reach here:
As we are configuring the local environment, we’d just click on Get Started and proceed.
That is all. You can see your images and containers right on your browser.
Now you can roam around and explore portainer. In a future post, I’ll demonstrate setting up Prometheus and Grafana with Portainer.
Portainer is not only for managing your local Docker workflow. You can manage Kubernetes, Nomad, and whatnot. Please head over to Portainer site for more info.
In next post, we are going to see how we can configure and manage a remote machine’s docker locally. See you later.