I have created my docker image and container using the Dockerfile in this blog. https://hackernoon.com/raspberry-pi-cluster-emulation-with-docker-compose-xo3l3tyw
I am able to ssh into the rpi and ifconfig returns the following status:
pi@raspberrypi:~ $ ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.0.2.15 netmask 255.255.255.0 broadcast 10.0.2.255
ether 52:54:00:12:34:56 txqueuelen 1000 (Ethernet)
RX packets 561 bytes 49862 (48.6 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 386 bytes 47311 (46.2 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 41 base 0x1000 dma 0xff
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
loop txqueuelen 1000 (Local Loopback)
RX packets 2 bytes 100 (100.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 2 bytes 100 (100.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
Now I want to be able to connect this to internet. As per docker docs, I tried to connect a running container to the internet using:
docker network connect multi-host-network 008796f5316a
It returns the error. Error response from daemon: network multi-host-network not found.
How can I connect to the internet from inside the docker?
Edit: The blog talks about running qemu on docker and installing a modified raspbian on top of that(for compatibility with qemu). When I access the container using docker exec command,
docker exec -it testnode bash
ifconfig returns the following:
root@1f210520938c:~# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 172.17.0.2 netmask 255.255.0.0 broadcast 172.17.255.255
ether 02:42:ac:11:00:02 txqueuelen 0 (Ethernet)
RX packets 637 bytes 356778 (356.7 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 404 bytes 39482 (39.4 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
loop txqueuelen 1000 (Local Loopback)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
And the ifconfig command for pi returns the results as shown above. So, ping google.com is working on the root@ and not on pi@raspberry.
I need to connect the pi directly to the internet.