当前位置:   article > 正文

docker-compose常见问题_docker.errors.invalidargument: "host" network_mode

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

一、新版本网络桥接

问题:

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

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"
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12

解决:

更换新版本后,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"
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10

二、更换日志输出后告警

问题:

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

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

解决:

升级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.

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Gausst松鼠会/article/detail/180616
推荐阅读
相关标签
  

闽ICP备14008679号