Ubuntu Docker image with minimal mono runtime in order to run F# app Ubuntu Docker image with minimal mono runtime in order to run F# app docker docker

Ubuntu Docker image with minimal mono runtime in order to run F# app


I'm answering the question as it is stated:

How can I proceed to only create an image containing the mono runtime?

For that, the answer is yes. There is a package for just the runtime called mono-runtime. In addition to that, there is an apt option to ignore installing recommended packages (usually docs and other stuff that may not be necessary for a runtime) with --no-install-recommends. Combining the two, we can get down to around 240 MB on the Ubuntu base:

FROM ubuntuRUN apt update && apt install -qy --no-install-recommends mono-runtime libfsharp-core4.3-cil

Also mentioned in comments, there are some more minimal images based on Alpine linux that may be of interest such as https://hub.docker.com/r/frolvlad/alpine-mono/ (which at the moment is around 200 MB).