What is Docker?
If you’re reading this, most probably you already know Docker or have at least heard about it a lot. But still, for the uninitiated, Docker is an open platform for developing, shipping, and running applications and it enables you to separate your applications from your infrastructure so you can deliver software quickly. Find Docker interesting and want to know more? Head over to their docs and you can find all the information you need!
What is Portainer?
So, talking about the elephant in the room, Portainer is a fully-featured web based GUI management tool for Docker. It runs locally, giving developers a rich UI to build and publish container images, deploy and manage applications and leverage data persistence and horizontal scaling for their applications.
Worried about the cost? Portainer Community Edition is open source, free forever and used by more than 500,000 developers worldwide.
What can I use Portainer for?
- Visualize your server’s docker environment on your web browser. (I know that you don’t fear the terminal, but hey, a little help won’t harm anybody!)
- Aggregate view of Docker Swarm clusters (Yeah, it’s that fancy!)
- Deploy containers with some pre-built templates, right from inside the Portainer.
- Start, Stop, Kill, Restart, Pause, Resume and Remove the containers easily with the web-GUI.
- Facing any issue while deploying containers? Don’t worry, Portainer to rescue! You can inspect the logs for any containers directly from the GUI and see what is stopping you from conquering the world.
How do I install Portainer?
So, you’re happy to give Portainer a go and want to know how can you install it? I have got you covered:
- Make sure you have Docker Engine installed on your server. You can follow the install instructions given here.
- Run the following command to create a docker volume which should give output as
portainer_dataindicating the command was successfully executed:
sudo docker volume create portainer_data
- Once the volume is created, run the following command to create and run the Portainer container:
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-ce
The above command should create and run the Portainer container on your server’s port number 9000, which can be generally accessed in following ways:
a) By opening
http://your_server_ip:9000 in your favorite browser.
b) If you have a domain name pointed towards your server’s IP, by opening
yourdomain.com:9000 in your browser.
Note: If you want to access Portainer over a subdomain instead of every time typing
yourdomain.com:9000, you can put it behind a reverse proxy with the help of any web server, like Caddy.
4. Alright, once the container is up and running, access it via any of the above methods and you will be greeted by the following initial setup screen of Portainer:
Set the username and password for admin user here and click on
5. Next, select Docker as the container management environment you want Portainer to connect to (yes Portainer can connect to Kubernetes too, but that’s a story for another day):
6. Voila! now you have successfully connected your local Docker environment to Portainer and you should be able to see below screen:
7. Click on the
local endpoint to see all the containers, images, volumes, networks etc. in your Docker environment:
8. You can also deploy app templates containers right from inside the Portainer:
This is it! Go on, play around a bit and I’m sure you’ll love how easy Portainer makes it to manage Docker containers. Given how many of the self-hosted apps can be deployed using Docker containers, Portainer is a must-have tool in your arsenal.