Create the Dockerfile
Learn how to create and inspect a Dockerfile using the docker init command in Docker Desktop.
We'll cover the following
Use 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 analyses 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. Feel free to accept a newer version of Node.js, but complete all other prompts as shown. You’ll need to run it from the ddd-book/node-app
directory.
We are using the Docker CLI, so the
docker init
command cannot be executed in the terminal below. You can find theDockerfile
in thenode-app
directory.
Get hands-on with 1200+ tech skills courses.