Hi All,
I have built a Yocto Hardknott image for the i.MX8 according to the following Variscite tutorial: Yocto Build Release | Variscite Wiki
Then, I added Docker by setting the following in local.conf:
IMAGE_INSTALL_append = " docker"
DISTRO_FEATURES_append = " virtualization"
The image builds fine, boots, and runs Docker (which takes a few minutes to start), however, the containers fail to connect to the docker0 bridge. For example, an Nginx container will not emit the expected boilerplate HTML via curl:
root@imx8qm-var-som:~# docker run -p 80:80 -d nginx
root@imx8qm-var-som:~# curl localhost
root@imx8qm-var-som:~# curl: (56) Recv failure: Connection reset by peer
This problem can be temporarily overcome by brctl:
root@imx8qm-var-som:~# brctl addif docker0 $(ifconfig | grep veth | cut -c 1-11)
root@imx8qm-var-som:~# curl localhost
html stuff that won’t render properly on the forum…
Specifically, Docker is not adding the veth interface to the docker0 bridge upon container creation/restart. I have tried modifying the Yocto build to replace NetworkManager with connman or nothing at all, but this doesn’t make a difference. In fact, when NetworkManager is running, “nmcli device status” shows docker0 as “connected (externally)”, which, to my knowledge, means that something other than NetworkManager is responsible for it.
I have repeated the test on a Dunfell version of the Variscite Yocto build, as well as a non-Variscite build of Yocto Hardknott for the Raspberry Pi 4, and Docker’s network bridge functions properly in both cases. However, swapping the meta-virtualization layer (which contains Docker itself among other things), meta-openembedded, or the Linux kernel from these into the Variscite Hardknott build doesn’t solve the problem. I had once considered the possibility that containerd was at fault, however, that is part of meta-virtualization, and would have been fixed by swapping that layer if it was the problem.
To recap, the problem appears to be specific to Variscite + Yocto Hardknott + Docker, and consists of a failure to automatically add the veth to docker0. Running the container with host networking does work, but is not suitable for my application. Any help would be greatly appreciated!