2018-12-17
玩Docker遇到的坑及解决方案
$ curl -H Host:whoami.docker.localhost http://127.0.0.1
Gateway Timeout
解决方法:
确保多个容器在同一个network下面
检查docker network ls
如果不指定network的名字,则默认是以docker-compose.yml所在文件夹的名字为前缀
底部networks那里增加name字段:
networks:
web:
name: web
traefik:
name: traefik
$ docker-compose up -d
ERROR: The Compose file './docker-compose.yml' is invalid because:
networks.traefik value Additional properties are not allowed ('name' was unexpected)
networks.web value Additional properties are not allowed ('name' was unexpected)
解决方法:version: '3.7'