Docker Init The Future of Easy Project Initialization
By Vladimir Mikhalev · Solutions Architect · Docker Captain · IBM Champion
Docker changed how we ship software, giving us a lightweight, portable, consistent runtime that works the same across different infrastructures. One of its newer additions is Docker Init, a CLI command that simplifies adding Docker to any project.
Understanding Docker Init
The Docker Init feature should not be confused with the internally used docker-init executable, which is triggered by Docker when using the --init flag with the docker run command. The Docker Init we’re discussing here is a new feature in its beta phase that automates the creation of essential Docker-related assets like Dockerfiles, .dockerignore files, and compose.yaml files.
The Docker Init feature presently supports Go, Node, and Python, with Docker’s development team actively extending support to other languages and frameworks, including Java, Rust, and .NET. This progressive expansion promises to make Docker Init even more useful to a wide range of developers.
Working with Docker Init
To use Docker Init, you’ll need Docker Desktop version 4.18 or later. Once this is set up, you can run the docker init command in your project’s target directory. Docker Init will detect the project’s characteristics and automatically generate the necessary Docker files. This feature is particularly valuable for developers who are new to Docker, those learning about containerization, or developers looking to integrate Docker into their existing projects.
Docker Init in Action
Let’s take a web server written in Go as an example.
We execute the command to start the process of automatically generating the necessary files to run the application using Docker Compose:
docker init
Next, you need to select the programming language in which your application is written.
NOTEIn this example, we are considering an application written in Go.
Select Go and press the “Enter” button.

Now you need to specify the installed version of Go.
NOTEIn this example, we consider working with version 1.20.
You can check the installed version with the command:
go versionSpecify the installed version of Go and press the “Enter” button.

Next, you need to select the project directory in which “main.go” is located.
NOTEIn this example, “main.go” is in the root directory of the project.
Select the project directory in which “main.go” is located and press the “Enter” button.

Now you need to specify the port on which the web server is running.
NOTEIn this example, the web server is using port 8081.
Select the port on which the web server is running and press the “Enter” button.

The necessary files to run the application using Docker Compose have been generated.
We start the web server using Docker Compose:
docker compose up --build
The web server has started and is using port 8081.
Now you can go to http://127.0.0.1:8081 and check if the web server is working.

The web server is running.

Benefits of Docker Init
Docker Init plays a significant role in automating the creation of necessary Docker assets and standardizing the process across different projects. It allows developers to focus more on the development of their applications, reducing the risk of errors and inconsistencies, and thereby accelerating the adoption of Docker and containerization.
After Docker Init has completed, there may be a need to modify the created files to align them with your project requirements. In such cases, you can refer back to the Docker documentation for further information.
Conclusion
Even in beta, Docker Init already simplifies adding Docker support to a project. By automating the creation of Docker assets, it removes one more piece of manual setup. As Docker refines and expands the feature, it’s likely to become a standard part of the toolkit.
The Verdict
Inconvenient truths about shipping in the AI era
Container security, platform engineering, and the agentic shift — tested in production, argued without the hype. The verdict reaches your inbox the moment there's one worth sending.
Related Posts
- 1Docker supply chain hardening — from Scout D to OpenSSF 7.8 on a 730K-pull imageDevOps & Cloud · How I hardened a 730K-pull public Docker image from Scout grade D to OpenSSF Scorecard 7.8. Multi-stage build, cosign signing, SLSA provenance, non-root default, and the incident that changed how I ship attestations.
- 2Cloudflare Web Analytics on Astro — Why Removing GA4 Unlocked Lighthouse 100DevOps & Cloud · How removing Google Analytics 4 from an Astro site unlocked Lighthouse 100, why Cloudflare Web Analytics replaced it, and what the tradeoffs actually cost.
- 3Platform Engineering — The Complete, Practical Guide to Building Internal Developer Platforms That ScaleDevOps & Cloud · A deep, practical guide to Platform Engineering. Learn how to build internal developer platforms, golden paths, GitOps workflows, and scalable cloud foundations.
- 4Amazon Q vs DevOps Chaos — Can This AI Fix AWS Faster Than You?DevOps & Cloud · Fix AWS issues faster with Amazon Q, the AI assistant built for DevOps. Real-world examples, limitations, and how it compares to ChatGPT.
Random Posts
- 1Mastering Terraform Tags for Infrastructure ExcellenceDevOps & Cloud · Master Terraform tagging with expert strategies to improve cost tracking, automation, access control, and compliance. Ideal for AWS, Azure, and GCP users.
- 2The 80th Anniversary of the Deportation of the Crimean TatarsOpinion & Culture · Marking 80 years since the 1944 deportation of Crimean Tatars by Stalin's regime. Explore the tragedy, its impact, and its echoes in modern-day Crimea.
- 3Install Home Assistant Using Docker ComposeSelf-Hosting · Step-by-step guide to install Home Assistant with Docker Compose and Traefik. Secure your smart home with HTTPS using Let's Encrypt.
- 4Docker supply chain hardening — from Scout D to OpenSSF 7.8 on a 730K-pull imageDevOps & Cloud · How I hardened a 730K-pull public Docker image from Scout grade D to OpenSSF Scorecard 7.8. Multi-stage build, cosign signing, SLSA provenance, non-root default, and the incident that changed how I ship attestations.