Portainer is a lightweight container management tool that provides a GUI for simplifying container operations. It supports all the major orchestration platforms - Kubernetes, Nomad, ACI, and multiple Docker environments (Docker hosts and Swarm clusters).
This tutorial will show you how to install Portainer for Docker on Linux. It will also provide instructions for using Portainer to deploy a containerized app.
- The latest version of Docker installed and running as root.
- Administrative access to the system.
Note: The tutorial covers the installation steps for Portainer Community Edition. Portainer also has a business edition, which requires purchasing a license.
Docker Portainer Installation
Portainer is deployed as a lightweight Docker container on any Linux system running Docker. The main component of Portainer is Portainer Server, which is used to manage containers, networks, and environments. Portainer Agent is the component installed on another Docker system to enable communication with the server.
Follow the steps below to install Portainer and deploy a containerized app to test the installation.
Step 1: Create Docker Volume
Portainer stores information on a Docker volume. Type the following command to create a Docker volume for the Portainer Server:
docker volume create portainer_data
If the operation is successful, the system outputs the name of the volume.
Step 2: Install Portainer Server
The latest Portainer Community Edition image is available on Docker Hub. Use the docker run command to pull the image and start a 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
Portainer exposes the UI via the secure port
8000 is used for edge computing and is optional unless you are planning to use edge agents.
Note: BMC offers affordable instances that satisfy all the performance requirements for edge computing.
docker run pulls the necessary images and starts the container. Check that Portainer is running by typing:
The command lists all the running containers. Find the container named
portainer and make sure its status is
Step 3: Access Portainer Dashboard
Portainer has a web UI accessible through an internet browser. To access the main Portainer dashboard:
1. In a browser, visit the following address:
Note: If you receive a blank page with the Client sent an HTTP request to an HTTPS server message, make to explicitly state
HTTPS as the connection type.
2. The first time you access Portainer, the system asks to create a password for the admin user. Type the password twice and select the Create user button.
The Environment Wizard starts.
3. Select the Get Started button to go to the dashboard and start using Portainer in the local environment only. To add other environments during the initial setup, click Add Environments.
Note: You can add environments later from the Portainer dashboard.
Step 4 (Optional): Add More Environments to Portainer Installation
You can manage multiple Docker environments within the Portainer UI. Moreover, each environment needs to have a Portainer Agent instance installed. The agent then uses port
9001 to communicate with the server.
Follow the steps below to add an environment to Portainer.
1. Type the following command to start a Portainer Agent container on the system you want to add:
docker run -d -p 9001:9001 --name portainer_agent --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/docker/volumes:/var/lib/docker/volumes portainer/agent:2.9.3
Wait for Docker to pull the necessary images and initiate the container.
2. To register the new environment in Portainer, you need the IP address of the system hosting the environment. If you do not know the IP, use the ip command to obtain it:
The command lists the network interfaces on your system. Make a note of the main interface's IP address.
Return to the Portainer Server UI.
3. Select Environments in the menu on the left side and click Add environment.
Note: If you select the Add Environments button in Step 3, Portainer takes you directly to the Create Environment page.
On the Create Environment page, fill in the details about the environment you want to add.
4. Write the name of the environment in the Name field
5. Type the URL of the system running Portainer Agent in the Environment URL field.
6. When you finish the setup, select the Add environment button in the Actions section.
The new environment appears on the Environments page.
Step 5: Deploy Container Using Portainer
Test your Portainer setup by deploying a test Docker container. Follow the steps below to install an Apache HTTP Server instance.
1. Select Containers in the menu on the left side to open the Containers page.
2. Click the Add container button in the action bar.
3. Provide details for the container you want to run, including the container name, the image name, and the connection ports.
4. When you finish setting up the container, scroll to the bottom of the page and select the Deploy the container button.
Wait for Portainer to deploy the container. When the container is ready, its state will be running.
5. Open another browser tab and type the IP address of your environment followed by the port assigned to the container. The Apache server shows the confirmation message.
After going through the steps in this tutorial, you will learn how to install Portainer to manage Docker containers on Linux.
The tutorial covered the steps for installing the Portainer Server instance and the procedure for adding environments to your installation.