0

i have a kubernetes cluster with flannel. It works fine. But when i start a container with docker run command, the container cannot reach outside.

$ docker run --rm -ti centos:7.3.1611 bash
[root@d8a7d18b312a /]# ping 10.33.46.2

10.33.46.2 is another node in my cluster, and ping failed.

ip a show docker0
6: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN
    link/ether 02:42:77:05:f5:6c brd ff:ff:ff:ff:ff:ff
    inet 172.17.0.1/16 scope global docker0
       valid_lft forever preferred_lft forever
    inet6 fe80::42:77ff:fe05:f56c/64 scope link
        valid_lft forever preferred_lft forever

it shows my docker0 is down. i know it uses cni for docker container in kubernetes cluster. But i cannot find any available network in

docker network list
NETWORK ID          NAME                DRIVER              SCOPE
a3bd58929a71        bridge              bridge              local
925a55f8f13d        host                host                local
f0c9234fb13f        none                null                local

i have no ideal how to use docker run in my cluster.

kaven
  • 1
  • 1

1 Answers1

0

I faced this problem on my K8S cluster where my Buildkite agents can't run docker builds because it haven't internet access. I resolved it by simply informing --network=host at the Docker command to use the host network instead of the default bridge network. I don't know if its the correct to do, but, it resolved my problem.