diff --git a/get-started/02_our_app.md b/get-started/02_our_app.md
index 23beda7dc6..32de1ba0e4 100644
--- a/get-started/02_our_app.md
+++ b/get-started/02_our_app.md
@@ -121,11 +121,15 @@ Now that you have an image, you can run the application in a [container](../get-
1. Start your container using the `docker run` command and specify the name of the image you just created:
```console
- $ docker run -dp 3000:3000 getting-started
+ $ docker run -dp 127.0.0.1:3000:3000 getting-started
```
- You use the `-d` flag to run the new container in "detached" mode (in the background). You also use the `-p` flag to create a mapping between the host's port 3000 to the container's port 3000.
- Without the port mapping, you wouldn't be able to access the application.
+ The `-d` flag (short for `--detached`) runs the container in the background.
+ The `-p` flag (short for `--publish`) creates a port mapping between the host and the container.
+ The `-p` flag take a string value in the format of `HOST:CONTAINER`,
+ where `HOST` is the address on the host, and `CONTAINER` is the port on the container.
+ The command shown here publishes the container's port 3000 to `127.0.0.1:3000` (`localhost:3000`) on the host.
+ Without the port mapping, you wouldn't be able to access the application from the host.
2. After a few seconds, open your web browser to [http://localhost:3000](http://localhost:3000){:target="_blank" rel="noopener" class="_"}.
You should see your app.
@@ -154,8 +158,8 @@ $ docker ps
```
Output similar to the following should appear.
```console
-CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
-df784548666d getting-started "docker-entrypoint.s…" 2 minutes ago Up 2 minutes 0.0.0.0:3000->3000/tcp priceless_mcclintock
+CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
+df784548666d getting-started "docker-entrypoint.s…" 2 minutes ago Up 2 minutes 127.0.0.1:3000->3000/tcp priceless_mcclintock
```
```console
- $ docker run -dp 3000:3000 \
+ $ docker run -dp 127.0.0.1:3000:3000 \
-w /app --mount type=bind,src="$(pwd)",target=/app \
node:18-alpine \
sh -c "yarn install && yarn run dev"
```
The following is a breakdown of the command:
- - `-dp 3000:3000` - same as before. Run in detached (background) mode and
+ - `-dp 127.0.0.1:3000:3000` - same as before. Run in detached (background) mode and
create a port mapping
- `-w /app` - sets the "working directory" or the current directory that the
command will run from
@@ -197,14 +197,14 @@ You can use the CLI or Docker Desktop to run your container with a bind mount.
```powershell
- $ docker run -dp 3000:3000 `
+ $ docker run -dp 127.0.0.1:3000:3000 `
-w /app --mount "type=bind,src=$pwd,target=/app" `
node:18-alpine `
sh -c "yarn install && yarn run dev"
```
The following is a breakdown of the command:
- - `-dp 3000:3000` - same as before. Run in detached (background) mode and
+ - `-dp 127.0.0.1:3000:3000` - same as before. Run in detached (background) mode and
create a port mapping
- `-w /app` - sets the "working directory" or the current directory that the
command will run from
diff --git a/get-started/07_multi_container.md b/get-started/07_multi_container.md
index 20c1436017..66380dd9a7 100644
--- a/get-started/07_multi_container.md
+++ b/get-started/07_multi_container.md
@@ -205,7 +205,7 @@ You can now start your dev-ready container.
```console
- $ docker run -dp 3000:3000 \
+ $ docker run -dp 127.0.0.1:3000:3000 \
-w /app -v "$(pwd):/app" \
--network todo-app \
-e MYSQL_HOST=mysql \
@@ -223,7 +223,7 @@ You can now start your dev-ready container.
In Windows, run this command in PowerShell.
```powershell
- $ docker run -dp 3000:3000 `
+ $ docker run -dp 127.0.0.1:3000:3000 `
-w /app -v "$(pwd):/app" `
--network todo-app `
-e MYSQL_HOST=mysql `
diff --git a/get-started/08_using_compose.md b/get-started/08_using_compose.md
index 556d9c6350..6727836e1a 100644
--- a/get-started/08_using_compose.md
+++ b/get-started/08_using_compose.md
@@ -45,7 +45,7 @@ And now, we'll start migrating a service at a time into the compose file.
To remember, this was the command we were using to define our app container.
```console
-$ docker run -dp 3000:3000 \
+$ docker run -dp 127.0.0.1:3000:3000 \
-w /app -v "$(pwd):/app" \
--network todo-app \
-e MYSQL_HOST=mysql \
@@ -77,7 +77,7 @@ $ docker run -dp 3000:3000 \
```
-3. Let's migrate the `-p 3000:3000` part of the command by defining the `ports` for the service. We will use the
+3. Let's migrate the `-p 127.0.0.1:3000:3000` part of the command by defining the `ports` for the service. We will use the
[short syntax](../compose/compose-file/05-services.md#short-syntax-3) here, but there is also a more verbose
[long syntax](../compose/compose-file/05-services.md#long-syntax-3) available as well.
@@ -87,7 +87,7 @@ $ docker run -dp 3000:3000 \
image: node:18-alpine
command: sh -c "yarn install && yarn run dev"
ports:
- - 3000:3000
+ - 127.0.0.1:3000:3000
```
4. Next, we'll migrate both the working directory (`-w /app`) and the volume mapping (`-v "$(pwd):/app"`) by using
@@ -101,7 +101,7 @@ $ docker run -dp 3000:3000 \
image: node:18-alpine
command: sh -c "yarn install && yarn run dev"
ports:
- - 3000:3000
+ - 127.0.0.1:3000:3000
working_dir: /app
volumes:
- ./:/app
@@ -115,7 +115,7 @@ $ docker run -dp 3000:3000 \
image: node:18-alpine
command: sh -c "yarn install && yarn run dev"
ports:
- - 3000:3000
+ - 127.0.0.1:3000:3000
working_dir: /app
volumes:
- ./:/app
@@ -196,7 +196,7 @@ services:
image: node:18-alpine
command: sh -c "yarn install && yarn run dev"
ports:
- - 3000:3000
+ - 127.0.0.1:3000:3000
working_dir: /app
volumes:
- ./:/app