Yocto in containers
Yocto is a tool for building a custom Linux-based OS for your chosen hardware target (e.g. Raspberry Pi, x86-64 PC, etc.). It also fully supports various devices emulated by QEMU, which is helpful for development and testing.
It is quite straightforward to run your Yocto builds inside containers during development (e.g. using a ubuntu-20.04
container), and this helpfully keeps your development environment consistent.
However, if you would like to use Yocto to build a container that you can then run using Docker (rather than building for a specific board or emulator), then this is more complex and not supported out-of-the-box. Containers typically don't need a complete filesystem and kernel to run (this is Yocto's usual output), and so there is quite a lot of work required to trim it down and configure it to do this. There was a presentation at ELC 2018 about it (video, slides).
Perhaps take a look through the Overview and Concepts Manual, which explains a bit more information about the architecture, QEMU emulator, and development environment.