「CentOS Stream 8」docker-compose1.28でcactiをインストールする方法

1.dockerバージョン確認
# docker –version
Docker version 20.10.5, build 55c4c88
docker-composeバージョン確認
# docker-compose –version
docker-compose version 1.28.5, build c4eb3a1f
2.cactiファイルをダウンロード
# git clone https://github.com/bashaway/cacti

Cloning into 'cacti'...
remote: Enumerating objects: 114, done.
remote: Counting objects: 100% (114/114), done.
remote: Compressing objects: 100% (72/72), done.
remote: Total 114 (delta 63), reused 89 (delta 39), pack-reused 0
Receiving objects: 100% (114/114), 162.20 KiB | 1.91 MiB/s, done.
Resolving deltas: 100% (63/63), done.

3.docker-compose.ymlの内容の確認
# cd cacti
# cat docker-compose.yml

version: '3'

services:
  cacti_db:
    build: ./cacti_db
    container_name: cacti_db
    hostname: cacti_db
    environment:
      MARIADB_DATABASE: cacti
      MARIADB_USER: cactiuser
      MARIADB_PASSWORD: cactipwd
      MARIADB_ROOT_PASSWORD: rootpwd
      TZ: 'Asia/Tokyo'
    networks:
      nw:
    ports:
      - "3306:3306"

  cacti_sv:
    build: ./cacti_sv
    container_name: cacti_sv
    hostname: cactia_sv
    restart: always
    networks:
      nw:
    ports:
      - 80:80
      - 443:443
    links:
      - cacti_db
    cap_add:
      - SYS_ADMIN
    security_opt:
      - seccomp:unconfined
    volumes:
      - /sys/fs/cgroup:/sys/fs/cgroup:ro
      - ./rra:/var/lib/cacti/rra
    environment:
      TZ: 'Asia/Tokyo'
    depends_on:
      - cacti_db

networks:
  nw:
    driver: bridge
    driver_opts:
      com.docker.network.bridge.enable_ip_masquerade: "true"
      com.docker.network.bridge.host_binding_ipv4: "0.0.0.0"
      com.docker.network.bridge.name: "cacti_nw"

3.firewallを設定
# firewall-cmd –add-port=80/tcp –zone=public –permanent
success
# firewall-cmd –reload
success

# firewall-cmd –add-port=3306/tcp –zone=public –permanent
success
# firewall-cmd –reload
success

4.dockerをbuildする
# docker-compose build
Building cacti_db
Sending build context to Docker daemon 5.12kB

Step 1/4 : FROM mariadb/server:latest

Successfully built 48123af85926
Successfully tagged cacti_cacti_sv:latest

5.docker起動を行う
# docker-compose up -d
Recreating cacti_db … done
Creating cacti_sv … done

6.ブラウザ確認
(1).http://192.168.229.129/cacti/
(2).「ユーザー名」と「パスワード」にadmin/adminでログインします。
(3).新しいパスワードを設定します。
(4).「Select default theme」に「Japanes」を選択し、
「Accept GPL License Agreement」チェックを入れます
(5).「開始」->「次に」をクリックします。
(6).「I have read this statement」チェックを入れて、「次に」を押下します。
(7).中略
(8).インストールをクリックします。

CentOS

Posted by arkgame