Install Portainer to handle your Docker administration

,

Portainer is a tool that can help you manage your docker containers through a nice web UI. You can install Portainer itself through Docker Compose.

First, make sure you have docker installed, including docker-compose. If not, you can follow the instructions here: https://alexmihai.rocks/2024/10/07/install-docker-on-your-ubuntu-home-server/ .

Copy this docker-compose.yml file to a folder on the machine you wish to install it on:

services:
  portainer:
    image: portainer/portainer-ce:2.21.3
    container_name: portainer
    ports:
      - 9000:9000
    volumes:
      - portainer-data:/data
      - /var/run/docker.sock:/var/run/docker.sock
    restart: unless-stopped

volumes:
  portainer-data: {}

From the the folder where you saved the docker-compose.yml file, run the following command:

$ docker compose up -d
[+] Running 12/12
 ✔ portainer Pulled
   ✔ 2fdd3e02e7e5 Pull complete
   ✔ 3745b0e5e59c Pull complete
   ✔ 39b5457baa4a Pull complete
   ✔ 27fb5b6e87d5 Pull complete
   ✔ ad26f2495f3e Pull complete
   ✔ 25275c19b336 Pull complete
   ✔ 8d194017ae2a Pull complete
   ✔ 5fa054b5db51 Pull complete
   ✔ f18343ae30bb Pull complete
   ✔ 21e9421a9e7c Pull complete
   ✔ 4f4fb700ef54 Pull complete
[+] Running 3/3
 ✔ Network portainer_default          Created
 ✔ Volume "portainer_portainer-data"  Created
 ✔ Container portainer                Started

Once started, you can access the UI at http://<hostname/ip>:9000/, where on the first access you will be asked to set a password for the admin user. If you installed it on your local machine, it will be at http://localhost:9000/, otherwise use the hostname or IP of the machine where you installed.

If you wait too long before setting the password, you’ll get a message like: Your Portainer instance timed out for security purposes. To re-enable your Portainer instance, you will need to restart Portainer.

In that case, from the command line you can run:

$ docker compose down
$ docker compose up -d

Then access the web UI again.

Hope this helps, have fun clickity-clacking.

Comments

Leave a Reply

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