Docker Image: Portainer

1. What is Portainer

Portainer is a universal container management tool that can work with both Docker and Kubernetes to make the deployment and management of containerized applications and services easier and more efficient.

Portainer hides the complexity of managing containers behind an easy-to-use UI. By removing the need to use the CLI, write YAML or understand manifests, Portainer makes deploying apps and troubleshooting problems so easy that anyone can do it.

— Portainer
Requires docker container support
  • Original install doc can be found here.

2. Install Portainer Client

  • Install a Portainer client on any server that hosts docker. The Portainer client will allow for management via a Portainer server.

  • Start the container via one of the following:

    1. Start via the docker command

      1. Unix

        sudo docker run -d -p 9001:9001 --name The-Portainer-Agent --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/docker/volumes:/var/lib/docker/volumes portainer/agent:latest
      2. Windows

        docker run -d -p 9001:9001 --name The-Portainer-Agent --restart=always -v C:\:C:\host -v C:\ProgramData\docker\volumes:C:\ProgramData\docker\volumes -v \\.\pipe\docker_engine:\\.\pipe\docker_engine portainer/agent:latest
    2. Start via the docker-compose command

      1. Compose the start file

        1. Unix

          version: "3.5"
          
          services:
          
            # Define a Portainer agent
            portainer_docker_agent:
              image: portainer/agent:latest
              container_name: The-Portainer-Agent
              ports:
              - 9001:9001
              volumes:
                - /var/run/docker.sock:/var/run/docker.sock
                - /var/lib/docker/volumes:/var/lib/docker/volumes
              restart: always
        2. Windows

      2. Start the container

        sudo docker-compose up -d

3. Install Portainer Server

  1. Create a volume for the Portainer Server’s DB

    sudo docker volume create portainer_data
  2. Start the container via one of the following:

    1. Start via the docker command

      sudo docker run -d -p 8000:8000 -p 9443:9443 --name The-Portainer-Server --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:latest
    2. Start via the docker-compose command

      1. Create a docker-compose.yml file with the following contents:

        version: "3"
        
        services:
          portainer:
            container_name: The-Portainer-Server
            image: portainer/portainer-ce:latest
            #command: -H tcp://tasks.agent:9443 --tlsskipverify
        
            ports:
              - 8000:8000
              - 9443:9443
        
            security_opt:
              - no-new-privileges:true
        
            volumes:
              - /etc/localtime:/etc/localtime:ro
              - /var/run/docker.sock:/var/run/docker.sock:ro
              - ./My-Portainer/data:/data
      2. Start the container

        sudo docker-compose up -d
  3. Open the Firewall for port 9443:

  4. Navigate to the containers web page:

    https://localhost:9443