Create the Dockerfile

Learn how to create and inspect a Dockerfile using the docker init command in Docker Desktop.

Using docker init to create the Dockerfile

In the past, we had to create Dockerfiles manually. Fortunately, newer versions of Docker support the docker init command that analyzes applications and automatically creates Dockerfiles that implement good practices. Run the following command to create a Dockerfile for the app. If your Docker installation doesn’t have the docker init plugin, you’ll have to skip this step.

Note: We are using the Docker CLI, so the docker init command cannot be executed in the terminal below. You can find the Dockerfile in the node-app directory.

Get hands-on with 1300+ tech skills courses.