我正在尝试设置 docker-compose 网络但命令
docker-compose --x-networking up
返回标准 docker-compose 帮助输出
Define and run multi-container applications with Docker.
Usage:
docker-compose [-f=<arg>...] [options] [COMMAND] [ARGS...]
docker-compose -h|--help
Options:
-f, --file FILE Specify an alternate compose file (default: docker-compose.yml)
-p, --project-name NAME Specify an alternate project name (default: directory name)
--verbose Show more output
-v, --version Print version and exit
Commands:
build Build or rebui...
(etc)
知道为什么吗?
最佳答案
这取决于您使用的 docker-compose 版本。 1.5 之前的版本没有这个标志。如果您使用的是 1.6; --x-networking
标志在 1.6 中不再存在,因为如果您的 docker-compose.yml
现在会自动使用它使用 2.0 格式
见release notes ;
Support for networking has exited experimental status and is the recommended way to enable communication between containers.
If you use the new file format, your app will use networking. If you want to keep using links, just leave your Compose file as it is and it'll continue to work just the same.
By default, you don't have to configure any networks. In fact, using networking with Compose involves even less configuration than using links. Consult the networking guide for how to use it: https://github.com/docker/compose/blob/1.6.0-rc1/docs/networking.md
The experimental flags --x-networking and --x-network-driver, introduced in Compose 1.5, have been removed.
关于docker-compose --x-networking up 不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35033050/