Pending real documentation.... We do have a development container which includes the same toolchain version that was used to build CoreOS but it works under systemd-nspawn, not docker, and isn't documented. But here is a quick guide that may be a useful starting place.
# on coreos
wget http://alpha.release.core-os.net/amd64-usr/current/coreos_developer_container.bin.bz2
bunzip2 coreos_developer_container.bin.bz2
sudo systemd-nspawn -i coreos_developer_container.bin --share-system
# inside container:
emerge-gitclone
emerge -gKav coreos-sources
cd /usr/src/linux
zcat /proc/config.gz >.config
make modules_prepare
After that you should be able to build both internal and external modules, but there is a major quirk here: /lib/modules is read-only so you cannot install them there, use depmod, or use modprobe. You can still load them with insmod by path but it is up to you to load them in the right order if you are building something complicated with lots of modules like ALSA. The Nvidia case does have an advantage here, being a single module there aren't dependencies to deal with.
Hmmm, this is why I couldn't get this working:
But if I throw in
--share-system
:Weirdly, if I omit
--share-system
:It works! I'll have to dig into this later.