I spent a week trying different configurations to solve this issue, the two main docker platforms I list below:
Windows 10 running linux docker container
Ubuntu 18.04 LTS running linux docker container
The final result on both platforms were consistent:
libwebsockets.h not found error
Mosquitto build fails
Not enough space available on the container
Workarounds (note: this works on a failed container):
Increase the default docker container size allocated by the docker daemon form 20Gb to 40Gb. I found the final build is 20.7Gb total and takes about 7 hours on Windows and 4 hours on Ubuntu...Give or take. This is done by modifying the docker daemon.json file.
docker attach <container ID> (note: CTRL-p CTRL-Q to SIGKILL)
Attach to the docker container and use VIM to modify the .config file and:
a. Search for all instances of the keyword "mosquitto" and comment them out from the build configuration. If you need mosquitto, you'll have to find another way around the issue.
note: I recommend addding the "is not used" value after commenting out the line
Either run make menuconfig to add libwebsockets library and the libwesockets examples to the build configuration. Or while you're modifying the .config file, do a search using VIM for libwebsockets and add the library and examples to the build.
note: I built libwebsockets library by [using an * in menuconfig or =y in .config they are accomplishing the same thing] and set the libwebsockets examples [M in menuconfig or =m in .config]
make -j1 V=s
Run make [options] inside of the attached container. Docker automatically creates several intermediate containers when necessary and I found that using a Dockerfile can be problematic for Cross-Compile build process.
The jist of it is that you'll need to use the Build System to do your cross compiling. If you need a separate library for your program, it will first have to be built by the build system before you can include it in your program.