效果
使用外部数据库
配置文件
bash
nano docker-compose.yml
bash
version: '3'
services:
phpipam-web:
image: phpipam/phpipam-www:latest
ports:
- "89:80"
environment:
- TZ=Asia/Shanghai
- IPAM_DATABASE_HOST=数据库地址
- IPAM_DATABASE_PASS=数据库ROOT密码
- IPAM_DATABASE_WEBHOST=%
- IPAM_DISABLE_INSTALLER= 初次安装可忽略此参数,安装完成之后赋值1重启容器即可
restart: unless-stopped
volumes:
- /data/docker/phpipam/phpipam-logo:/phpipam/css/images/logo
phpipam-cron:
image: phpipam/phpipam-cron:latest
environment:
- TZ=Asia/Shanghai
- IPAM_DATABASE_HOST=数据库地址
- IPAM_DATABASE_PASS=数据库ROOT密码
- SCAN_INTERVAL=1h
restart: unless-stopped
只需要确保数据库
root
用户能登录成功即可,无需手动创建数据库,如创建有需先删除
启动服务
bash
[root@ip phpipam]# docker-compose up -d
creating phpipam_phpipam-web_1 ...
creating phpipam_phpipam-web_1 ... done
[root@ip phpipam]#
使用全新数据库
配置文件
bash
nano docker-compose.yml
bash
version: '3'
services:
phpipam-web:
image: phpipam/phpipam-www:latest
ports:
- "89:80"
environment:
- TZ=Asia/Shanghai
- IPAM_DATABASE_HOST=phpipam-mariadb
- IPAM_DATABASE_PASS=数据库密码
- IPAM_DATABASE_WEBHOST=%
- IPAM_DISABLE_INSTALLER=0
restart: unless-stopped
volumes:
- /data/docker/phpipam/phpipam-logo:/phpipam/css/images/logo
depends_on:
- phpipam-mariadb
phpipam-cron:
image: phpipam/phpipam-cron:latest
environment:
- TZ=Asia/Shanghai
- IPAM_DATABASE_HOST=phpipam-mariadb
- IPAM_DATABASE_PASS=数据库密码
- SCAN_INTERVAL=1h
restart: unless-stopped
depends_on:
- phpipam-mariadb
phpipam-mariadb:
image: mariadb:latest
environment:
- MYSQL_ROOT_PASSWORD=数据库密码
restart: unless-stopped
volumes:
- /data/docker/phpipam/mysql:/var/lib/mysql
启动服务
bash
[root@ip phpipam]# docker-compose up -d
Recreating phpipam_phpipam-mariadb_1 ... done
Recreating phpipam_phpipam-web_1 ... done
Recreating phpipam_phpipam-cron_1 ... done
[root@ip phpipam]#
最后附上当前可用的docker加速配置