Categories
Uncategorized

Install a GUI for Docker Portainer

Since we started covering docker content about a month ago I’ve had several emails from viewers asking about graphical user interfaces rather than having to use a command line. This is the write up for you if you rather use a GUI, web interface then the command line.

Portainer is a web-based user interface that allows you to manage and monitor your Docker containers, images, networks, and volumes. It provides an easy-to-use and intuitive interface for managing your Docker environment, without requiring any knowledge of Docker’s command line interface. Some of the features of Portainer include:

  • Container management: Portainer allows you to start, stop, and remove Docker containers, as well as view logs and access container details.
  • Image management: You can manage Docker images with Portainer, including pulling and pushing images to and from Docker registries.
  • Network management: Portainer allows you to create and manage Docker networks, including inspecting network details and adding and removing containers from networks.
  • Volume management: With Portainer, you can create, manage, and inspect Docker volumes.
  • User management: You can manage user access to Portainer and Docker resources with Portainer’s RBAC (Role-Based Access Control) system.
  • Dashboard: Portainer provides a customizable dashboard that gives you an overview of your Docker environment, including container and resource usage.

Overall, Portainer simplifies the management of Docker containers and makes it easier for users of all skill levels to work with Docker.

This wright up is going to assume that you already have docker and docker compose installed on your system and will be using Ubuntu 22.04

To start the install of Portainer after you have installed Docker and docker-compose you are going to need to make a folder and 2 files one to launch Portainer and the other to start it when your system starts up / reboots.

The first one I am going to do is make the folder I will be calling my folder portainer and I will be storing it at /home/[username]

mkdir portainer

the first file that we will be making and storing in the portainer folder is the docker-compose.yaml file this is what you will use to start portainer on your docker server.

sudo nano docker-compose.yaml
version: "3"

services:
  portainer:
    image: portainer/portainer-ce:latest
    container_name: portainer
    restart: always
    ports:
      - "9000:9000"
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock"
      - "portainer_data:/data"

volumes:
  portainer_data:

in this file we tell docker to use the latest portainer image, open port 9000 to port 9000 into CT, and map two folders to the portainer image from the host OS.

This file by it’s self will be enough to start and use portainer but it will not be much go to you if your server restart and then you go to use it. so lets make portainer start as a service by making a second file.

sudo nano /etc/systemd/system/portainer.service 
[Unit]
Description=Portainer Container
Requires=docker.service
After=docker.service

[Service]
Restart=always
ExecStart=/usr/local/bin/docker-compose -f [your path]/portainer/docker-compose.yml up
ExecStop=/usr/local/bin/docker-compose -f [your path]/portainer/docker-compose.yml down

[Install]
WantedBy=multi-user.target

This file tells Ubuntu to start and stop portainer just like it would other services on the server as it starts and shuts down.

now it is time to start the image

sudo systemctl enable portainer.service
sudo systemctl start portainer.service

Leave a Reply