Portainer is an open source tool for containers management UI for Docker, including Docker Swarm environment. It easier for DevOps to manage the Docker containers like, start, stop, restart, pause, resume, kill and add new container. It allows you to manage containers, images, volumes and networks from the web-based Portainer dashboard.

In this post we will discuss how to download and deploy the portrainer container in your docker. Before that, you need to install the Docker latest version in your local machine or on your server.

Generally, we need to pull the portainer image from the docker-hub using the command,

$ sudo docker pull portainer/portainer

Now, you can run the Portainer use the command below,

$ sudo docker run -d -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock portainer/portainer

Make sure the container is running in your docker,

$ sudo docker ps

$ sudo  docker container ls
CONTAINER ID        IMAGE                 COMMAND                  CREATED             STATUS              PORTS                    NAMES
4b875620a853        portainer/portainer   "/portainer -H unix:…"   23 seconds ago      Up 22 seconds>9000/tcp   root_portainer_1

Another way to deploy the Portainer image use docker-compose. Create a filename called docker-compose.yaml and paste the lines below,

version: '3.1'
    image: portainer/portainer
    command: -H unix:///var/run/docker.sock
    restart: always
      - 9000:9000
      - /var/run/docker.sock:/var/run/docker.sock
      - portainer_data:/data

Save this file and run the command below,

$ sudo docker-compose up -d

Creating network "root_default" with the default driver
Creating volume "root_portainer_data" with default driver
Pulling portainer (portainer/portainer:)...
latest: Pulling from portainer/portainer
d1e017099d17: Pull complete
8f8668d9390b: Pull complete
Creating root_portainer_1 ... done