Thanks to @elMaczete (see answer above) following lines can be added to a Dockerfile
(Ubuntu based)
# Modify the CPU_FLAGS matching your project (in this case a STM32L4xxx)
ARG CPU_FLAGS="-mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16"
RUN nosys=$(arm-none-eabi-g++ ${CPU_FLAGS} -print-file-name=libnosys.a) && \
arm-none-eabi-objcopy --wildcard --remove-section .gnu.warning.* $nosys