解决docker部署,容器内部网络不互通问题
docker-compose网桥部署
version: '3'
networks:
net-common:
external: true
services:
zhi-mini:
build:
context: ./
restart: always
ports:
- 7788:7788
environment:
TZ: "Asia/Shanghai"
container_name: zhi-mini
hostname: zhi-mini
image: zhi-mini:24090201638
volumes:
- /usr/share:/usr/share
- /sainiao/zhijian/zhijian-mini/log:/sainiao/zhijian/log
- /sainiao/zhijian/zhijian-mini/cert:/sainiao/zhijian/cert
networks:
- net-common
docker操作
创建网桥
docker network create net-common
查看所有网桥
docker network list
查看当前容器网桥
docker inspect zhi-mq
docker部署指定网桥
docker run --restart=always --privileged=true -e PARAMS="--spring.datasource.username=xxx --spring.datasource.password=xxxx --spring.datasource.url=jdbc:mysql://172.17.0.1:3307/xxl_job?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&serverTimezone=Asia/Shanghai" -p 8888:8080 -v /usr/local/docker/xxl-job/logs:/data/applogs --name xxl-job-admin --network net-common -d xuxueli/xxl-job-admin:2.4.1
评论区