Skip to content

Commit 6f38646

Browse files
committed
Update README.md
1 parent 1754ad2 commit 6f38646

File tree

1 file changed

+41
-13
lines changed

1 file changed

+41
-13
lines changed

README.md

Lines changed: 41 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ docker images
4444

4545
> [!NOTE]
4646
> You should now see four images listed.
47-
>
47+
>
4848
> ```shell
4949
> $ docker images
5050
> REPOSITORY TAG IMAGE ID CREATED SIZE
@@ -53,7 +53,7 @@ docker images
5353
> public.ecr.aws/lambda/nodejs 24 30d41baede74 3 days ago 449MB
5454
> curlimages/curl latest 26c487d15124 2 weeks ago 24.5MB
5555
> ```
56-
>
56+
>
5757
> _Image IDs, created and sizes may vary._
5858
5959
---
@@ -127,9 +127,11 @@ docker compose run -it --rm --entrypoint /bin/sh -v ./nodejs:/var/task lambda
127127
> [!WARNING]
128128
> Due to AWS not creating multi-platform images we need to start an interactive shell rather than passing in commands.
129129
> For example, if we were to run the following command:
130+
>
130131
> ```shell
131132
> docker compose run -it --rm --entrypoint /bin/sh -v ./nodejs:/var/task lambda node --version
132133
> ```
134+
>
133135
> In some cases, we would receive the error `/var/lang/bin/node: /var/lang/bin/node: cannot execute binary file`.
134136
135137
### Image check
@@ -260,27 +262,27 @@ CMD [ "build/index.handler" ]
260262
> As we're now doing the dependency install as part of the build, when you run `docker images` you'll notice our Docker image has increased in size.
261263
>
262264
> ```shell
263-
> $ docker images
265+
> $ docker images
264266
> REPOSITORY TAG IMAGE ID CREATED SIZE
265267
> your-lambda latest 05b92630088f 3 seconds ago 483MB
266268
> public.ecr.aws/lambda/nodejs 24 30d41baede74 3 days ago 449MB
267269
> ```
268270
269271
> [!TIP]
270272
> When running `docker images` you'll notice that we have got a dangling image that looks a bit like this:
271-
>
273+
>
272274
> ```shell
273-
> $ docker images
275+
> $ docker images
274276
> REPOSITORY TAG IMAGE ID CREATED SIZE
275277
> your-lambda latest 05b92630088f 3 seconds ago 483MB
276278
> public.ecr.aws/lambda/nodejs 24 30d41baede74 3 days ago 449MB
277279
> <none> <none> 17e6c55f785f 3 days ago 449MB
278280
> ```
279281
>
280282
> When you rebuilt the image, Docker moved the "nametag" to your new version, leaving the old version behind as a nameless orphan.
281-
>
283+
>
282284
> Any dangling images can be cleaned with the following command:
283-
>
285+
>
284286
> ```shell
285287
> docker image prune
286288
> ```
@@ -417,8 +419,8 @@ docker compose up --abort-on-container-exit
417419

418420
> [!NOTE]
419421
> On this execution you'll see that the `curl` container received `Task timed out after 0.00 seconds`.
420-
> Find the Lambda `REPORT` again and you'll see `Init Duration`, `Duration` and `Billed Duration` are all set to `0 ms`.
421-
>
422+
> Find the Lambda `REPORT` again and you'll see `Init Duration`, `Duration` and `Billed Duration` are all set to `0 ms`.
423+
>
422424
> **Be sure to set `AWS_LAMBDA_FUNCTION_TIMEOUT` back to `3` now.**
423425
424426
### Create the events subdirectory
@@ -570,7 +572,7 @@ docker compose up --abort-on-container-exit --build
570572
> => CACHED [2/5] COPY ./package*.json /var/task
571573
> => CACHED [3/5] RUN npm ci
572574
> => [4/5] COPY ./ /var/task
573-
> => [5/5] RUN npm run build
575+
> => [5/5] RUN npm run build
574576
> ```
575577
576578
### Multi-stage build
@@ -793,24 +795,50 @@ docker compose up --abort-on-container-exit --build
793795

794796
Since we are done with the workshop, let's remove the resources we created.
795797

796-
Run the following command to stop all services, remove the containers/networks, and delete all images used by this project (including the Node/Python base images, LocalStack, and the custom image we built):
798+
Run the following command:
799+
800+
```shell
801+
docker compose ps -a
802+
```
803+
804+
> [!NOTE]
805+
> Even though they're not running, we still have this images sitting there doing nothing.
806+
807+
Run the following command:
808+
809+
```shell
810+
docker compose images
811+
```
812+
813+
> [!NOTE]
814+
> We also have these images which are taking up resources on our machine.
815+
816+
Run the following command to stop all services, remove the containers/networks, and delete all images used by this project (including cURL, LocalStack, and the custom image we built):
797817

798818
```shell
799819
docker compose down --rmi all
800820
```
801821

822+
> [!TIP]
823+
> You will likely have a number of dangling images where we've made changes through out this workshop, run the following to clean them up:
824+
>
825+
> ```shell
826+
> docker image prune
827+
> ```
828+
802829
> [!WARNING]
803830
> If you followed the prerequisites to run `docker load` this command will not actually remove all images, the `lambda/node` and `lambda/python` images still exist.
804-
>
831+
>
805832
> To remove these you'll need to run the following:
833+
>
806834
> ```shell
807835
> docker rmi public.ecr.aws/lambda/nodejs:24
808836
> ```
837+
>
809838
> ```shell
810839
> docker rmi public.ecr.aws/lambda/python:3.14
811840
> ```
812841

813-
814842
---
815843

816844
## 🎉 Congratulations

0 commit comments

Comments
 (0)