DEV Community

Shahriyar Al Mustakim Mitul
Shahriyar Al Mustakim Mitul

Posted on

Docker series (Part 9): Basics of Docker file

Dockerfile is the file which helps creating an image.

Lets learn the basics from a basic docker file. You may know more : https://docs.docker.com/engine/reference/builder/

Image description

Now, lets learn line by line

  1. First we import from some distribution so that we can save our time.

Image description
We have imported from debian distribution. It surely can vary.Here we are using the release "buster-slim"

  1. Give the way to set environment variables.

Image description

Image description

  1. Run command which runs several shell commands of the distribution you are using.

Image description

it uses && to keep the within 1 layer

  1. Pointing our log files to stdout & stderr

Image description
Basically docker handles all of our logging here .

  1. Expose ports

By default no ports are open but we can open them by listing them here

Image description

  1. Final commands to run

Image description

So, these were the basics of Dockerfile.

Top comments (0)