Manage containers easily with Portainer
Portainer is a web-based tool to manage Docker containers, easy to install and use.
Table of Contents
Installation
Portainer use Docker as its backend, so first ensure you have Docker installed.
Then, follow these steps to install Portainer with Docker on Linux (run as root or with ‘sudo’, rootless Docker may need additional configuration):
- Create a volume.
docker volume create portainer_data
- Run Portainer Server container:
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:2.9.3
- Go to
https://localhost:9443
. Replacelocalhost
with your server IP if access remotely (you may need to open the port on your firewall). Accept the self-signed certificate.
Usage
Create an administrator user
First time you open Portainer, you must create an administrator user. Type a password and press “Create user”.
Run a container
To start, press on “Get Started” and then click on “local” to use the local environment.
You can see all the resources of this environment: images, containers, volumes, networks, etc. Press on the container section.
Here you can find all the running or stopped containers. Click on “Add container”.
In this window you can type all the options you usually type when running docker run
: type an optional name for the container, specify the image, press on “publish a new network port” to map container ports to host.
Scroll down and you’ll find more options like “Console” to specify if you want interactive mode (-i
, keep stdin open even if not attached) and TTY (-t
, allocate a pseudo-TTY). When you want to access to container console, you usually select “Interactive & TTY”.
Finally, click on “Deploy the container”.
Access container console
On the Container List window, you’ll see some icons below “Quick actions” section. Press “>_” and click “Connect”.
Manage a container
If you press the container name in “Container List” window, you’ll find the container details. Here you can stop or remove the container, check its status or get more info, stats, etc.
Other options
You’ve learned the basic use of Portainer, but this great tool has a lot of features:
- Pull and manage images.
- “App Templates”. Templates to run popular containers like “Nginx”.
- Create users (administrators or ordinary users).
More info
Check https://www.portainer.io/help_about to get more info about Portainer.
If you have any suggestion, feel free to contact me via social media or email.
Latest tutorials and articles:
Featured content: