一、新版本网络桥接

问题:

docker.errors.InvalidArgument: "host" network_mode is incompatible with port

1.24.0以前可以network_mode: host和ports: xxx可以一起使用

version: "3.0"
services:
  mail-service:
    image: 192.168.17.198/xiaoqiangzai/mail-service:38
    container_name: mail-service
    network_mode: host
    privileged: true
    restart: always
    ports:
      - "8082:8082"
    environment:
      - "ENVIRONMENT=dev"

解决:

更换新版本后,network_mode:是host的要去掉ports

version: "3.0"
services:
  mail-service:
    image: 192.168.17.198/xiaoqiangzai/mail-service:38
    container_name: mail-service
    network_mode: host
    privileged: true
    restart: always
    environment:
      - "ENVIRONMENT=dev"

二、更换日志输出后告警

问题:

docker更换日志驱动为loki后,docker-compose启动容器出现告警

WARNING: no logs are available with the 'loki' log driver

解决:

升级docker-compose版本,我这里从1.24.0升级到1.29.2就解决了