启动配置
docker-compose.yaml
配置文件
version: '3.3'
services:
adguard:
image: adguard/adguardhome:latest
container_name: adguard
restart: unless-stopped
volumes:
- ./workdir:/opt/adguardhome/work
- ./confdir:/opt/adguardhome/conf
ports:
- 53:53/tcp
- 53:53/udp
- 81:80/tcp
- 3000:3000/tcp
networks:
custom-bridge:
logging:
options:
max-size: "10m"
networks:
custom-bridge:
external: true
docker-compose up -d
启动服务,然后有一个引导页面,进行初始化配置,自定义配置admin/1到8
路由器上配置全局dns
处理容器的dns问题
连接到这个路由器的linux上的docker在解析dns时有问题,无法正确解析,因为docker配置的默认dns地址时127.0.0.11
,很奇怪是这个地址,所以在容器运行时配置下默认的dns,在docker-compose.yaml
中添加dns字段,这个ip地址是adguard所在的ip,用宿主机的ip就好:172.18.0.1,这样就比较固定,adguard以后可以随便改变docker网桥中的ip。
比如:
version: '3.3'
services:
alist:
image: xhofe/alist:v3.32.0
container_name: alist
restart: unless-stopped
environment:
- PUID=0
- PGID=0
- UMASK=022
volumes:
- ./etc:/opt/alist/data
ports:
- 5244:5244
networks:
custom-bridge:
logging:
options:
max-size: "10m"
dns: 172.18.0.1
networks:
custom-bridge:
external: true
或者修改docker daemon的东西,两种方式都可以生效,随便选一种就好。临时配置用上一种,永久配置用下一种
{
"insecure-registries": [
"pet.anarckk.me:5000",
"cache.registry.bee.anarckk.me:80",
"main.registry.bee.anarckk.me:80"
],
"log-opts": {
"max-size": "10m",
"max-file": "3"
},
"registry-mirrors": ["https://docker.mirrors.ustc.edu.cn"],
"dns": ["172.18.0.1","192.168.0.1"]
}