docker-compose --x-networking up 不工作

docker-compose --x-networking up not working

我正在尝试设置 docker-compose 网络但是命令

docker-compose --x-networking up

Return 标准 docker-撰写帮助输出

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.