Skip to content

Commit 94104c1

Browse files
guides: remove init
Signed-off-by: Craig Osterhout <craig.osterhout@docker.com>
1 parent 692f368 commit 94104c1

26 files changed

Lines changed: 866 additions & 1038 deletions

content/get-started/docker-concepts/building-images/writing-a-dockerfile.md

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -147,21 +147,14 @@ Now that you have the project, you’re ready to create the `Dockerfile`.
147147
> build cache, run as a non-root user, and multi-stage builds.
148148

149149

150-
> **Containerize new projects quickly with `docker init`**
151-
>
152-
> The `docker init` command will analyze your project and quickly create
153-
> a Dockerfile, a `compose.yaml`, and a `.dockerignore`, helping you get
154-
> up and going. Since you're learning about Dockerfiles specifically here,
155-
> you won't use it now. But, [learn more about it here](/reference/cli/docker/init/).
156-
157150
## Additional resources
158151

159152
To learn more about writing a Dockerfile, visit the following resources:
160153

161154
* [Dockerfile reference](/reference/dockerfile/)
162155
* [Dockerfile best practices](/develop/develop-images/dockerfile_best-practices/)
163156
* [Base images](/build/building/base-images/)
164-
* [Getting started with Docker Init](/reference/cli/docker/init/)
157+
* [Gordon](/ai/gordon/) — Docker's AI assistant can generate a Dockerfile for your project. Ask Gordon to analyze your code and suggest a Dockerfile optimized for your language and framework.
165158
166159
## Next steps
167160

content/guides/angular/containerize.md

Lines changed: 25 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -43,78 +43,15 @@ $ git clone https://github.com/kristiyan-velkov/docker-angular-sample
4343
```
4444
---
4545

46-
## Generate a Dockerfile
47-
48-
Docker provides an interactive CLI tool called `docker init` that helps scaffold the necessary configuration files for containerizing your application. This includes generating a `Dockerfile`, `.dockerignore`, `compose.yaml`, and `README.Docker.md`.
49-
50-
To begin, navigate to the root of your project directory:
51-
52-
```console
53-
$ cd docker-angular-sample
54-
```
55-
56-
Then run the following command:
57-
58-
```console
59-
$ docker init
60-
```
61-
You’ll see output similar to:
62-
63-
```text
64-
Welcome to the Docker Init CLI!
65-
66-
This utility will walk you through creating the following files with sensible defaults for your project:
67-
- .dockerignore
68-
- Dockerfile
69-
- compose.yaml
70-
- README.Docker.md
71-
72-
Let's get started!
73-
```
74-
75-
The CLI will prompt you with a few questions about your app setup.
76-
For consistency, please use the same responses shown in the example below when prompted:
77-
| Question | Answer |
78-
|------------------------------------------------------------|-----------------|
79-
| What application platform does your project use? | Node |
80-
| What version of Node do you want to use? | 24.12.0-alpine |
81-
| Which package manager do you want to use? | npm |
82-
| Do you want to run "npm run build" before starting server? | yes |
83-
| What directory is your build output to? | dist |
84-
| What command do you want to use to start the app? | npm run start |
85-
| What port does your server listen on? | 8080 |
86-
87-
After completion, your project directory will contain the following new files:
88-
89-
```text
90-
├── docker-angular-sample/
91-
│ ├── Dockerfile
92-
│ ├── .dockerignore
93-
│ ├── compose.yaml
94-
│ └── README.Docker.md
95-
```
96-
97-
---
98-
9946
## Build the Docker image
10047

101-
The default Dockerfile generated by `docker init` serves as a solid starting point for general Node.js applications. However, Angular is a front-end framework that compiles into static assets, so we need to tailor the Dockerfile to optimize for how Angular applications are built and served in a production environment.
102-
103-
### Step 1: Improve the generated Dockerfile and configuration
48+
Angular is a front-end framework that compiles into static assets, so the Dockerfile uses a multi-stage build: one stage compiles the app with Node.js, and a second minimal stage serves the static output with Nginx.
10449

105-
In this step, you’ll improve the Dockerfile and configuration files by following best practices:
106-
107-
- Use multi-stage builds to keep the final image clean and small
108-
- Serve the app using Nginx, a fast and secure web server
109-
- Improve performance and security by only including what’s needed
110-
111-
These updates help ensure your app is easy to deploy, fast to load, and production-ready.
112-
113-
> [!NOTE]
114-
> A `Dockerfile` is a plain text file that contains step-by-step instructions to build a Docker image. It automates packaging your application along with its dependencies and runtime environment.
115-
> For full details, see the [Dockerfile reference](/reference/dockerfile/).
50+
> [!TIP]
51+
>
52+
> [Gordon](/ai/gordon/), Docker's AI assistant, can generate Docker assets for your project. Ask Gordon to create a Dockerfile, Compose file, and `.dockerignore` tailored to your application.
11653
117-
### Step 2: Configure the Dockerfile
54+
### Step 1: Create the Dockerfile
11855

11956
Before creating a Dockerfile, you need to choose a base image. You can either use the [Node.js Official Image](https://hub.docker.com/_/node) or a Docker Hardened Image (DHI) from the [Hardened Image catalog](https://hub.docker.com/hardened-images/catalog).
12057

@@ -191,7 +128,7 @@ CMD ["-g", "daemon off;"]
191128
{{< /tab >}}
192129
{{< tab name="Using the Docker Official Image" >}}
193130

194-
Now you need to create a production-ready multi-stage Dockerfile. Replace the generated Dockerfile with the following optimized configuration:
131+
Create a file named `Dockerfile` with the following contents:
195132

196133
```dockerfile
197134
# =========================================
@@ -252,7 +189,20 @@ CMD ["-g", "daemon off;"]
252189
{{< /tab >}}
253190
{{< /tabs >}}
254191

255-
### Step 3: Configure the .dockerignore file
192+
### Step 2: Create the compose.yaml file
193+
194+
Create a file named `compose.yaml` with the following contents:
195+
196+
```yaml {collapse=true,title=compose.yaml}
197+
services:
198+
server:
199+
build:
200+
context: .
201+
ports:
202+
- 8080:8080
203+
```
204+
205+
### Step 3: Create the .dockerignore file
256206
257207
The `.dockerignore` file tells Docker which files and folders to exclude when building the image.
258208

@@ -264,7 +214,7 @@ The `.dockerignore` file tells Docker which files and folders to exclude when bu
264214
>
265215
> To learn more, visit the [.dockerignore reference](/reference/dockerfile.md#dockerignore-file).
266216

267-
Copy and replace the contents of your existing `.dockerignore` with the configuration below:
217+
Create a file named `.dockerignore` with the following contents:
268218

269219
```dockerignore
270220
# ================================
@@ -434,8 +384,7 @@ After completing the previous steps, your project directory should now contain t
434384
│ ├── Dockerfile
435385
│ ├── .dockerignore
436386
│ ├── compose.yaml
437-
│ ├── nginx.conf
438-
│ └── README.Docker.md
387+
│ └── nginx.conf
439388
```
440389

441390
Now that your Dockerfile is configured, you can build the Docker image for your Angular application.
@@ -455,7 +404,7 @@ What this command does:
455404
- Tags the image as docker-angular-sample so you can reference it later
456405

457406

458-
#### Step 6: View local images
407+
### Step 6: View local images
459408

460409
After building your Docker image, you can check which images are available on your local machine using either the Docker CLI or [Docker Desktop](/manuals/desktop/use-desktop/images.md). Since you're already working in the terminal, let's use the Docker CLI.
461410

@@ -547,9 +496,8 @@ $ docker compose down
547496
In this guide, you learned how to containerize, build, and run an Angular application using Docker. By following best practices, you created a secure, optimized, and production-ready setup.
548497

549498
What you accomplished:
550-
- Initialized your project using `docker init` to scaffold essential Docker configuration files.
551-
- Replaced the default `Dockerfile` with a multi-stage build that compiles the Angular application and serves the static files using Nginx.
552-
- Replaced the default `.dockerignore` file to exclude unnecessary files and keep the image clean and efficient.
499+
- Created a multi-stage `Dockerfile` that compiles the Angular application and serves the static files using Nginx.
500+
- Created a `.dockerignore` file to exclude unnecessary files and keep the image clean and efficient.
553501
- Built your Docker image using `docker build`.
554502
- Ran the container using `docker compose up`, both in the foreground and in detached mode.
555503
- Verified that the app was running by visiting [http://localhost:8080](http://localhost:8080).
@@ -566,7 +514,6 @@ Explore official references and best practices to sharpen your Docker workflow:
566514
- [Multi-stage builds](/build/building/multi-stage/) – Learn how to separate build and runtime stages.
567515
- [Best practices for writing Dockerfiles](/develop/develop-images/dockerfile_best-practices/) – Write efficient, maintainable, and secure Dockerfiles.
568516
- [Build context in Docker](/build/concepts/context/) – Learn how context affects image builds.
569-
- [`docker init` CLI reference](/reference/cli/docker/init/) – Scaffold Docker assets automatically.
570517
- [`docker build` CLI reference](/reference/cli/docker/image/build/) – Build Docker images from a Dockerfile.
571518
- [`docker images` CLI reference](/reference/cli/docker/image/ls/) – Manage and inspect local Docker images.
572519
- [`docker compose up` CLI reference](/reference/cli/docker/compose/up/) – Start and run multi-container applications.

content/guides/angular/develop.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,7 @@ After completing the previous steps, your project directory should now contain t
112112
│ ├── Dockerfile.dev
113113
│ ├── .dockerignore
114114
│ ├── compose.yaml
115-
│ ├── nginx.conf
116-
│ └── README.Docker.md
115+
│ └── nginx.conf
117116
```
118117

119118
### Step 4: Start Compose Watch

content/guides/angular/run-tests.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,7 @@ After completing the previous steps, your project directory should contain the f
7979
│ ├── Dockerfile.dev
8080
│ ├── .dockerignore
8181
│ ├── compose.yaml
82-
│ ├── nginx.conf
83-
│ └── README.Docker.md
82+
│ └── nginx.conf
8483
```
8584

8685
### Step 2: Run the tests

0 commit comments

Comments
 (0)