What is a Dockerfile? It contains instruction that docker uses to package up an application into an image. Containers and Images , What are these? Images : An image includes everything an application needs to run. It includes application files, environment variables and so on. Container : Once we have an image, we can start a container from it. A container is like a VM in a sense that it provides an isolated environment for executing an application. Similar to VM we can stop and restart a container. Simplified Analogy: Think of images as a class(blueprint) and containers as running instance(objects) for that blueprint. Steps to create a Dockerfile: Choose a correct base image Setup the working directory Copy application files into the image. Example: COPY <source> <destination> Exclude files & folders(node_modules, venv, etc) Adding environment variables Exposing ports By default docker runs an application with the root user that has the highest privileges. Diff.…