-
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 network inspect networkId
找出server所在网略,然后启动client时候通过
--network networkId
加入到对应网络中。docker run -it --rm --link clickhouse_name:clickhouse-server --network compose_default yandex/clickhouse-client --host clickhouse-server
可能会出现
flag provided but not defined: --network
这个问题,
参考[2],改为:
docker run -it --rm --link clickhouse_name:clickhouse-server --net=compose_default yandex/clickhouse-client --host clickhouse-server
-
--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