(20210302已解决)clickhouse docker, as it does not belong to the default network

  • Overview

    通过client容器连接server容器出现如下问题:

    docker: Error response from daemon: Cannot link to /clickhouse_20.8.13.15, as it does not belong to the default network

    clickhouse_20.8.13.15是我自定义的clickhouse server容器。

  • Analysis

    理解Creating network “projectName_default” with the default driver

    log说的很明白,因为client容器与server容器不在同一份network中。

    $ docker network ls
    $ docker inspect networkId
    

    找出server所在网略,然后启动client时候通过--network networkId加入到对应网络中。

  • --link
    --link <name or id>:alias
    

    From docker docs, --link flag is a legacy feature of Docker, it may eventually be removed.

  • --host
    --host  # Daemon socket to connect to
    
  • References

  1. Overview of docker-compose CLI

猜你喜欢

转载自blog.csdn.net/The_Time_Runner/article/details/114434710