When you write Dockerfile, Docker container should include a single process and contain minimum required to run it. You do not need an entire operating system.
You can reduce your Docker image size by using Alpine image as base image for your dockerfile. It will only include binaries or libraries that you need.
Example: -
FROM node:14.16.0 image size ~ 943MB
FROM node:14.16.0-alpine image size ~ 116MB
You can see the size difference between both images size.
Alpine Linux is a Linux distribution that is smaller in size and more secure.