DEV Community

Cover image for Let's discover: docker init command
Aurélie Vache
Aurélie Vache

Posted on • Edited on

Let's discover: docker init command

Welcome in this new (serie of?) article titled: "Let's discover".

This time, no sketchnotes, but we will discover a new tool, a new technology or this time, a new command that I wait for a loooonnggg time: docker init command.

Docker init

In short: docker init allows you to dockerize your application. That's it! :-)

When you execute docker init command in your project, in your repository for example, it generates for you:

  • a Dockerfile
  • a .dockerignore
  • and a docker-compose.yaml compose.yaml file

So after executing docker init command you just have to build and run your container or run it through docker compose and test your application :-).

Test it!

Stop the blahblah, let's discover and test this new docker init command, in video! :-)

As you can see, the docker init command is in Beta and you need to update Docker Desktop to version 4.18.
At the moment it only supports the Go language and the teams are working to support Python, Rust, Node.js, Java and even .Net languages.

Edit: At the moments it supports Go, Python, Rust & Node.js and the teams are working to support Java and even .Net languages.
If you want a support for a specific language or a framework, you can ask to Docker.

Conclusion

As I said before, I have been waiting for this command for a long time.

I love to fine-tune my DockerFile in order to have small Docker images but I like when things are easy and frictionless and I know it's not easy to create a simple DockerFile when you start (and even when you know Docker technology ^^) so I'm happy with this new feature and I hope it can help a lot of people to start their Docker and Containers journey! :-)

Top comments (4)

Collapse
 
tbroyer profile image
Thomas Broyer

So I'm telling everyone at work that the compose spec says it should be compose.yaml and no longer docker-compose.yaml, and Docker adds a new command that creates a… docker-compose.yaml 😭

Collapse
 
aurelievache profile image
Aurélie Vache

Exactly!
I thought the same thing. But the good news is that it's in Beta so the command will evolves :-).

Collapse
 
aurelievache profile image
Aurélie Vache

Docker teams noticed and fixed already for the next version ♥️

Thread Thread
 
aurelievache profile image
Aurélie Vache

Good news!
with Docker desktop 4.19 the compose file name have been fixed 🎉