Warning
This information refers to an outdated version of Ubuntu that no longer receives standard security maintenance. For security reasons, we recommend using a current version with official support.
Portainer lets you manage your Docker containers through a graphical interface and works with Docker servers or Swarm clusters. Portainer uses very few resources and runs as a Docker container (the Docker image is less than 4 MB). Once Docker is installed, installing Portainer is straightforward.
Installing Docker
As usual, before installing a package, make sure your server is up to date:
# apt update
# apt upgradeInstall the packages needed to install Docker:
# apt install apt-transport-https ca-certificates curl software-properties-commonAdd Docker's official GPG key:
# curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -Enable Docker's repository and update the package list:
# add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
# apt updateInstall the latest version of Docker:
# apt install docker-ceInstalling Portainer
As mentioned at the beginning of this article, installing Portainer is straightforward because it runs in a Docker container. To install it, run:
# docker volume create portainer_data
# docker run -d -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer:lastImportant
To access Portainer, you must allow TCP port 5432 in your server's firewall. For security reasons, we recommend allowing connections only from the public IP address of your Internet connection. If you are unsure how to add a rule to your firewall profile, see our article explaining how to create a firewall rule.
Now that Portainer is installed and the port is open, the first step is to configure it. Go to http://[SERVER_PUBLIC_IP]:9000, create a password for your admin user, select Local, and connect to your Docker environment by clicking Connect.
The next step is to configure your server's IP address. Go to Endpoints and click local. In the window that opens, enter your server's public IP address in Public IP. The following screenshot shows this step:
Now that Portainer is installed and configured, you can create your containers in several ways: App Templates, Stacks, or Images > Containers.
Once you deploy a new container, it will appear in the Containers section:
Installing Portainer with SSL
If you want to configure Portainer with a domain name and SSL for a secure connection without using the IP address, follow these steps.
First, install Certbot to generate a certificate with Let's Encrypt:
# apt install certbotThen generate the certificate:
# certbot certonly --standalone --preferred-challenges http -d [domain]Finally, start the Portainer container with the parameters needed to use the SSL certificate:
# docker run -d -p 443:9000 -p 8000:8000 --name portainer --restart always -v /var/run/docker.sock:/var/run/docker.sock -v portainer-data:/data -v /etc/letsencrypt/live/[domain]:/certs/live/[domain]:ro -v /etc/letsencrypt/archive/[domain]:/certs/archive/[domain]:ro portainer/portainer-ce:2.6.3 --ssl --sslcert /certs/live/[domain]/cert.pem --sslkey /certs/live/[domain]/privkey.pemImportant
Remember to replace [domain] with the domain name you have chosen to access Portainer.
Remember, if you have any questions about this or any other matter related to your servers at Clouding, feel free to email soporte@clouding.io We’re here for whatever you need. Just ask us!