Let's discover: docker init command

Aurélie Vache - Apr 6 '23 - - Dev Community

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! :-)

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .