docker 容器固定mac地址
报错信息
tomcat | ===========产品服务器注册码为:
tomcat | linux
tomcat | java.io.IOException: Cannot run program "ifconfig": error=2, No such file or directory
docker-compose 配置:
version: '3'
services:
tomcat:
image: tomcat:7
container_name: tomcat
restart: always
volumes:
- ./data/proszgd:/data/proszgd
- ./data/userFile:/userFile
- ./data/backupFile:/backupFile
- ./data/autoback:/autoback
- ./data/conf:/usr/local/tomcat/conf
- ./data/logs:/usr/local/tomcat/logs
- /usr/sbin/ifconfig:/usr/sbin/ifconfig
mac_address: 18:26:49:9b:0f:b4
ports:
- "8080:8080"
environment:
- TZ=Asia/Shanghai
说明:
固定MAC地址,并将宿主的ifconfig挂载到容器
volumes:
- /usr/sbin/ifconfig:/usr/sbin/ifconfig
mac_address: 18:26:49:9b:0f:b4