限制容器间不受控的互相网络通信

同一主机上所有容器间默认不限制网络通信。因此,每个容器都可以读取同一主机上容器网络中的所有报文,这可能导致信息在无意中被泄露到其他容器。因此,建议对容器间的通信进行限制。

修改Docker的启动参数,增加“--icc=false”参数,关闭容器之间的通信,示例如下所示。

……
[Service]
Type=notify
# the default is not to use systemd for cgroups because the delegate issues still
# exists and systemd currently does not support the cgroup feature set required
# for containers run by docker
ExecStart=/usr/bin/dockerd  --userland-proxy=false --icc=false -H fd:// --containerd=/run/containerd/containerd.sock
ExecReload=/bin/kill -s HUP $MAINPID
TimeoutSec=0
RestartSec=2
Restart=always
……