You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The `Dockerfile` is the place where you put the instructions that allow Docker to *build* an image. Every instruction represents the creation of a layer, which is a modification of the image file system that is being created.
108
106
109
-
In this case, we're composing our image by starting from a template, sometimes called the *base image*, that in this case is `node:20.17`. This is an official image provided by the Docker company, and you can find more about it [here](https://hub.docker.com/_/node).
107
+
In this case, we're composing our image by starting from a template, sometimes called the *base image*, that in this case is `node:22`. This is an official image provided by the Docker company, and you can find more about it [here](https://hub.docker.com/_/node).
110
108
111
109
The next step sets the `NODE_ENV` environment variable to `production`. The main effect here is to avoid installing development packages when running the npm installation below, but it can often lead to better optimizations in modules you might be relying on.
112
110
@@ -148,7 +146,7 @@ docker build -t myproject .
148
146
149
147
The `-t` option specifies the name of the image, in this case `myproject`. The `.` at the end of the line is required to tell Docker to look for a `Dockerfile` in the current directory.
150
148
151
-
**NOTE**: the first time that you run the build, it will take a while because Docker has to download all the layers of the base image (Node.js 20.17 in this case).
149
+
**NOTE**: the first time that you run the build, it will take a while because Docker has to download all the layers of the base image (Node.js 22 in this case).
152
150
153
151
Since we're going to upload this image to the Docker Hub online registry (to make it accessible from our server), we need to name the image by using a specific convention.
154
152
@@ -163,10 +161,10 @@ Where `username` is your Docker Hub username, and `latest` is the *tag* of the i
163
161
```sh
164
162
docker build -t myproject .
165
163
docker tag myproject username/myproject:latest
166
-
docker tag myproject username/myproject:20240905
164
+
docker tag myproject username/myproject:20250902
167
165
```
168
166
169
-
These commands build an image and then tag it with the tags `latest` and `20240904` (the date this tutorial was last updated).
167
+
These commands build an image and then tag it with the tags `latest` and `20250902` (the date this tutorial was last updated).
170
168
171
169
Docker Hub doesn't remove old images by default, so this allows to have an history of all the images that you pushed to the registry. The image with tag `latest` will always be the one that was most recently built, while the older ones will be tagged with a date.
172
170
@@ -257,7 +255,7 @@ This is a very basic Docker Compose file that configures a single container call
0 commit comments