{"id":13112,"date":"2022-06-09T22:41:40","date_gmt":"2022-06-09T19:41:40","guid":{"rendered":"https:\/\/kifarunix.com\/?p=13112"},"modified":"2024-03-09T15:21:43","modified_gmt":"2024-03-09T12:21:43","slug":"install-portainer-on-ubuntu","status":"publish","type":"post","link":"https:\/\/kifarunix.com\/install-portainer-on-ubuntu\/","title":{"rendered":"Install Portainer on Ubuntu 22.04"},"content":{"rendered":"\n
In this tutorial, you will learn how to install Portainer on Ubuntu 22.04. Portainer<\/a> is a self-service container service delivery platform that provides container management GUI for Kubernetes, Docker and Swarm<\/em>.<\/p>\n\n\n\n Portainer is available as both Community Edition and Business Edition. We will be installing the Community Edition in this guide.<\/p>\n\n\n\n There are different environments in which you can deploy Portainer;<\/p>\n\n\n\n In this tutorial, we will learn how to install Portainer as a standalone Docker container.<\/p>\n\n\n\n You can also check how to setup Portainer with SSL certificates by following the link below;<\/p>\n\n\n\n Setup Portainer with SSL Certificates<\/a><\/p>\n\n\n\n To begin with, you need to install Docker on Ubuntu 22.04 by running the commands below;<\/p>\n\n\n\n Start and enable Docker to run on system boot;<\/p>\n\n\n\n Once the Docker is in place, it is now time to deploy Portainer on Ubuntu 22.04.<\/p>\n\n\n\n To begin with, you need to create Portainer server data volume. Please note that Portainer requires persistent storage<\/a> in order to maintain the database and configuration information it needs to function<\/em>.<\/p>\n\n\n\n You can create a Docker volume using the command;<\/p>\n\n\n\n For example, to create a volume called You can confirm the volumes by listing them;<\/p>\n\n\n\n Sample output;<\/p>\n\n\n\n The voume is created under the Docker host path, \/var\/lib\/docker\/volumes\/<\/strong>. See the output from the command below;<\/p>\n\n\n\n Next, download and install Portainer server Docker container on Ubuntu 22.04;<\/p>\n\n\n\n Demystifying the Docker command line options used above;<\/p>\n\n\n\n Read more on Sample output from the command above;<\/p>\n\n\n\n Portainer server should now be running.<\/p>\n\n\n\n You can list running Docker container using the command;<\/p>\n\n\n\n Sample output;<\/p>\n\n\n\n You can confirm that actually, the Portainer server UI port is opened on the host as well.<\/p>\n\n\n\n Portainer server web services is exposed to the Docker host on port 9443\/TCP.<\/p>\n\n\n\n In order to access Portainer server UI, then navigate to the browser and enter the address If Firewall is running, ensure that your open port 9443\/TCP to allow external access to Portainer web service.<\/p>\n\n\n\n Accept the self-signed SSL exception and proceed to Portainer server web interface.<\/p>\n\n\n\n Create Admin user and password by entering password and click Create User.<\/strong><\/p>\n\n\n\n You should then land on the Portainer server web interface.<\/p>\n\n\n\n Home;<\/p>\n\n\n\nInstall Portainer on Ubuntu 22.04<\/h2>\n\n\n\n
\n
Install Docker on Ubuntu 22.04<\/h3>\n\n\n\n
curl -fsSL https:\/\/download.docker.com\/linux\/ubuntu\/gpg \\\n| sudo gpg --dearmor > \/etc\/apt\/trusted.gpg.d\/docker.gpg<\/code><\/pre>\n\n\n\n
echo \\\n\"deb [arch=$(dpkg --print-architecture)] https:\/\/download.docker.com\/linux\/ubuntu $(lsb_release -cs) stable\" \\\n| sudo tee \/etc\/apt\/sources.list.d\/docker.list > \/dev\/null<\/code><\/pre>\n\n\n\n
apt update<\/code><\/pre>\n\n\n\n
sudo apt install docker-ce docker-ce-cli containerd.io<\/code><\/pre>\n\n\n\n
systemctl enable --now docker<\/code><\/pre>\n\n\n\n
Create Portainer Server Docker Data Volume<\/h3>\n\n\n\n
docker volume create [OPTIONS] [VOLUME-NAME]<\/code><\/pre>\n\n\n\n
pt_data<\/code><\/strong>, you can use the command. Name can be anything of your preference.<\/p>\n\n\n\n
docker volume create pt_data<\/code><\/pre>\n\n\n\n
docker volume ls<\/code><\/pre>\n\n\n\n
DRIVER VOLUME NAME\nlocal pt_data<\/code><\/pre>\n\n\n\n
docker volume inspect pt_data<\/code><\/pre>\n\n\n\n
[\n {\n \"CreatedAt\": \"2022-06-09T17:56:05Z\",\n \"Driver\": \"local\",\n \"Labels\": {},\n \"Mountpoint\": \"\/var\/lib\/docker\/volumes\/pt_data\/_data\",\n<\/strong> \"Name\": \"pt_data\",\n \"Options\": {},\n \"Scope\": \"local\"\n }\n] \n<\/code><\/pre>\n\n\n\n
Install Portainer as Standalone Docker Container on Ubuntu 22.04<\/h3>\n\n\n\n
docker run -d -p 8000:8000 -p 9443:9443 --name portainer \\\n--restart=always -v \/var\/run\/docker.sock:\/var\/run\/docker.sock \\\n-v pt_data<\/strong>:\/data portainer\/portainer-ce:latest<\/code><\/pre>\n\n\n\n
\n
9443<\/code> for the UI and API and on an optional port TCP
8000<\/code>, which is only required if using Edge Compute features with Edge Agents.<\/li>\n\n\n\n
9001<\/code><\/li>\n<\/ul>\n\n\n\n
\n
-d\/--detach<\/code><\/strong>: Causes the container in background and print container ID<\/li>\n\n\n\n
-p\/--publish<\/strong><\/code>: Exposes\/Publishes a container’s port(s) to the host.\n
\n
--name<\/code><\/strong>: Assign a name to the container.<\/li>\n\n\n\n
--restart<\/strong><\/code>: Restart policy to apply when a container exits (default “no”)\n
\n
-v\/--volume<\/code><\/strong>: Bind mount a Docker container volume.\n
\n
-v \/var\/run\/docker.sock:\/var\/run\/docker.sock<\/code><\/strong>: This causes the Portainer Server container process to communicate with the main host Docker process.<\/li>\n\n\n\n
-v pt_data:\/data<\/code><\/strong>: Mounts the Portainer Server container data,
\/data<\/code><\/strong>, to the host path
\/var\/lib\/docker\/volumes\/pt_data<\/code><\/strong>.<\/li>\n<\/ul>\n<\/li>\n\n\n\n
portainer\/portainer-ce:latest<\/code><\/strong>.<\/li>\n<\/ul>\n\n\n\n
docker run --help<\/code>.<\/p>\n\n\n\n
Unable to find image 'portainer\/portainer-ce:latest' locally\nlatest: Pulling from portainer\/portainer-ce\n772227786281: Pull complete \n96fd13befc87: Pull complete \ndc6f8e90d5b4: Pull complete \n0e84c6386ab3: Pull complete \nDigest: sha256:52f9fdee1e4acfb1b5c4ddd15c88905287efb6e8f8058d2c5a2543ddc72e9dc0\nStatus: Downloaded newer image for portainer\/portainer-ce:latest\n521fb09ed7c7daa9241c85e469928e232d5034edb6d8ec4b89d3ba4e5fc601eb\n<\/code><\/pre>\n\n\n\n
docker ps<\/code><\/pre>\n\n\n\n
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES\n521fb09ed7c7 portainer\/portainer-ce:latest \"\/portainer\" About a minute ago Up 48 seconds 0.0.0.0:8000->8000\/tcp, :::8000->8000\/tcp, 0.0.0.0:9443->9443\/tcp, :::9443->9443\/tcp, 9000\/tcp portainer\n<\/code><\/pre>\n\n\n\n
ss -altnp | grep 9443<\/code><\/pre>\n\n\n\n
LISTEN 0 4096 0.0.0.0:9443 0.0.0.0:* users:((\"docker-proxy\",pid=3760,fd=4)) \nLISTEN 0 4096 [::]:9443 [::]:* users:((\"docker-proxy\",pid=3767,fd=4))\n<\/code><\/pre>\n\n\n\n
Accessing Portainer Server Web Interface<\/h3>\n\n\n\n
https:\/\/docker-domain-or-IP:9443<\/strong><\/code><\/p>\n\n\n\n
<\/figure><\/div><\/a><\/div>\n\n\n\n
<\/figure><\/div><\/a><\/div>\n\n\n\n