docker-compose常见问题

一、新版本网络桥接

问题:

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就解决了

作者(Author):小强崽
来源(Source):https://www.wuduoqiang.com/archives/docker-compose常见问题
协议(License):署名-非商业性使用-相同方式共享 4.0 国际 (CC BY-NC-SA 4.0)
版权(Copyright):商业转载请联系作者获得授权,非商业转载请注明出处。 For commercial use, please contact the author for authorization. For non-commercial use, please indicate the source.

你可能感兴趣的:(Docker,docker)