Docker与网络和"内部"组成。属性示例

时间:2016-11-23 14:30:57

标签: docker docker-compose docker-networking

我试图找到使用示例" internal"在docker-compose.yml v2中使用网络声明的属性。

换句话说,我搜索如何做到这一点:

docker network create someName --internal

但在docker-compose.yml。

尝试使用此变体时出错:

version: '2'

services:
# services definition

networks:
  someName:
    internal: true

错误讯息:

The Compose file '.\docker-compose.yml' is invalid because:
networks.someName value Additional properties are not allowed ('internal' was unexpected)

1 个答案:

答案 0 :(得分:3)

升级到docker-compose 1.9或更高版本,内部网络是docker-compose.yml的新功能。

升级说明在the compose releases page