Portainer on Docker – Manage all your docker containers

Portainer on Docker – Manage all your docker containers

In this tutorial, let’s learn how to set up portainer on docker

What is a Portainer?

  • Portainer is a light weight GUI management tool that can be used to manage Docker, Swarm, Kubernetes and ACI environments
  • Furthermore, it is a single container that can be deployed on any cluster
  • Additionally, It also provides a neat and extremely user friendly UI to manage all your Docker containers in one place

We will mainly be focusing on how to deploy portainer on docker and manage your docker containers easily in this tutorial

Read more here: https://www.portainer.io/

Steps to deploy

1. Create a volume mount for the container data as shown below

docker volume create portainer_data

2. Deploy the docker container

# -d specifies the container to run in detached state
# -p specifies the port mapping in the format <host-port>:<container-port>
# --name specifies the name of the docker container
# --restart=always restarts the container if it stops in any circumstance
# -v /var/run/docker.sock:/var/run/docker.sock is required in order to be able to run docker commands on the host from portainer
# -v portainer_data:/data links the /data directory within the container to the portainer_data volume mount created on the host
# portainer/portainer-ce specifies the image for the container
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 \

3. Login to the Portainer UI from your browser which is on port 9000 in this case (http://ip:9000), Enter a username and password and click on “Create user”


4. We need to select the container environment that we need to manage through portainer in this page which in our case will be docker.
Select Docker and click on Connect


5. We should now be able to see the portainer dashboard as shown below and the local docker environment which we have added will also be visible as shown below.


6. Click on the local Docker environment to get to the Dashboard for the local docker containers. Here, we will be able to see the stats of our local docker environment


7. Click on Container to view the containers that are deployed on the local docker environment. In our case, we have deployed only portainer and we can see it present in the list of the containers. The containers can be easily managed using the controls provided like Start, Stop, Kill etc.. Let’s try opening the link provided in the published ports column.

We can observe that this will directly open a tab with the ip being and port 9000. This will work if you have deployed portainer on your local environment. But if you have deployed it in a remote environment we will need to configure the default ip for the endpoints which is explained in the next step.


8. Go to the “Endpoints” section in the menu


9. Select the local endpoint from the list and open it. After that, Enter the IP of your remote machine in the Public IP field and click on Update Endpoint. Now, Revisit Step 7 now and it should work as intended.


Congratulations!! You have successfully set up Portainer on Docker

3340cookie-checkPortainer on Docker – Manage all your docker containers

One Comment

  1. Pingback:Watchtower on Docker - Automate Docker image updates » EasyCode

Leave a Comment

Your email address will not be published. Required fields are marked *