general/other How to emulate FreeBSD on Linux or Windows via Docker?

Thinking of the environment of continuous integration and continuous delivery and services that already run scripts to automatically deploy, such as Travis, CircleCI and GitHub Workflows for example, it allows you to use a docker image made from a container, to perform actions on the container , citing C / C ++ for example, it is possible to write the code and when sending to the repository, every commit today it is possible to compile, run unit tests, run valgrind and package (generating static package * .deb , * rpm or etc ...) and send to the repository, which allows, besides having a test at each commit, to automate various tasks.

It is possible today to use QEMU to emulate different architectures like arm64 for example (running from a docker) and use the same machine to generate packages for different architectures.

In the docker repository (https://hub.docker.com/) I was unable to find an official freebsd image, something that would run on windows or linux, I quote these platforms, as they are generally available through continuous integration platforms.

I believe that if there is a container of the official freebsd docker and how to run it on linux or windows, it would help a lot to popularize freebsd, besides helping a lot of programmers who develop for the platform and use the service of continuous integration of platforms similar to mentioned, but I lack the knowledge to develop a FreeBSD scratch and I don't even know what changes are necessary for it to run on Linux or Windows, that's why I'm on the community forum to find out if there are any projects in this sense, because I researched and didn't find, forgive if any and I have not researched with due attention.

If anyone knows how to do it, please let me know how.
 
You don't appear to grasp the fact that docker images are Linux and always will be. There are no other operating systems possible. It's a container format not an emulation or virtualization platform. So, no, there are no FreeBSD docker images, just as there are no Windows or MacOS docker images. The only reason you can run docker images on Windows is because of WSL.

With regards to CI:

And note that things like Jenkins (devel/jenkins) or Gitlab-runner (devel/gitlab-runner) can run natively on FreeBSD. TeamCity also runs just fine on FreeBSD.

but I lack the knowledge to develop a FreeBSD scratch and I don't even know what changes are necessary for it to run on Linux or Windows
Emulation or virtualization is the only way. There is no "FreeBSD compatibility layer" on Linux or Windows. FreeBSD does have a Linux compatibility layer which allows us to run Linux binaries (to a certain degree, it's not perfect). But Windows or Linux doesn't have something similar to run FreeBSD binaries on. Windows does have "Windows Services for Linux" (WSL), this allows it to run Linux binaries.

Chapter 10. Linux® Binary Compatibility
 
I lack the knowledge to develop a FreeBSD scratch
FreeBSD Handbook and FreeBSD Architecture Handbook
I don't even know what changes are necessary for it to run on Linux or Windows,
FreeBSD as a Guest on VirtualBox

Also FreeBSD has it's own Hypervisor and virtualisation mechanism. If you're interested refer to bhyve and Jails

[EDIT]:
I think the best to approach FreeBSD is to think of it as completely different animal. Operating System is a vague term. For example Windows has its own application, but Windows 10 and Windows Server are different things. Same goes for Linux. Superficially Linux and FreeBSD may seem similar. But they aren't. Pear and apples. Take your time and study FreeBSD architecture, especially /usr/src.
 
Back
Top