Skip to content

Commit 79a8aba

Browse files
committed
add comments on clarity, update TIP for pip install requirements.txt
- clarity regarding Docker, Dockerfile, stopping containers started without interactive mode - add some instructions, specify port number explicitly
1 parent ddf3d71 commit 79a8aba

File tree

1 file changed

+35
-4
lines changed

1 file changed

+35
-4
lines changed

chapter_09_docker.asciidoc

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ How will containerizing our software help with the danger areas?
241241

242242
// TODO: consider getting rid of the staging server??
243243

244+
////
244245
245246
old content follows. is there anything we want to rescue from here?
246247
@@ -535,7 +536,9 @@ But it's a little less well established and documented,
535536
(the Windows installation instructions are a little more DIY for example),
536537
and in the end, although I'm a fan of a plucky upstart,
537538
Docker is open source too,
538-
so I didn't decide to stick with Docker. But you could definitely check it out!
539+
so I decided to stick with Docker. But you could definitely check it out!
540+
// CSANAD: Based on the premises in the sentence and the fact that we are using Docker
541+
// all along the chapter, I think it was meant to be like this.
539542
540543
You can follow along all the instructions in the book
541544
by just substituing the `docker` binary for `podman` in all the CLI instructions,
@@ -576,6 +579,11 @@ What do we need to do? Something like this, right?
576579

577580
.Dockerfile (ch09l003)
578581
====
582+
583+
// CSANAD: I think just a few words would be nice here, such as: "let's create
584+
// a new file called `Dockerfile` next to the `src/` directory we've just
585+
// created."
586+
579587
[source,dockerfile]
580588
----
581589
FROM python:slim <1>
@@ -644,6 +652,9 @@ $ pass:quotes[*docker build -t superlists .*]
644652
=> => naming to docker.io/library/superlists 0.0s
645653
----
646654

655+
// CSANAD: Just a note: this output is slightly smaller and faster compared to when
656+
// the reader first runs the `docker build`.
657+
647658
Now we can see our image in the list of docker images on the system:
648659

649660
[subs="specialcharacters,quotes"]
@@ -812,6 +823,14 @@ TIP: Forgetting the `-r` and running `pip install requirements.txt`
812823
because (at the time of writing), it's not very self-explanatory.
813824
And it's a mistake I still make, _all the time_.
814825

826+
// CSANAD: This is no longer true, the error message is very helpful by now:
827+
//
828+
// $ pip install requirements.txt
829+
// ERROR: Could not find a version that satisfies the requirement requirements.txt (from versions: none)
830+
// HINT: You are attempting to install a package literally named "requirements.txt" (which cannot exist). Consider using the '-r' flag to install the packages listed in requirements.txt
831+
// ERROR: No matching distribution found for requirements.txt
832+
833+
815834

816835
==== Successful run
817836

@@ -862,7 +881,14 @@ WARNING: Make sure you use the `-it` flags to the Docker `run`
862881
to be run in an interactive terminal session,
863882
otherwise you'll get strange behaviours, including not being able
864883
to interrupt the docker process with _Ctrl-C_.
865-
884+
In case it already happened, you can terminate it using
885+
`docker stop <container_id>`.
886+
Also, it's worth mentioning that you can specify just enough characters
887+
of the container ID that uniquely identifies the container - e.g. if you
888+
have a container with the ID `abcdef123456` and no other container ID
889+
starts with `a`, you can use just `a` to reference this container in your
890+
Docker commands:
891+
`docker stop a`.
866892

867893

868894

@@ -887,12 +913,15 @@ Nope! What's going on here? Time for a little debugging.
887913

888914
=== Debugging a Container Networking Problems
889915

890-
First let's try and take a look ourselves, in our browser:
916+
First let's try and take a look ourselves, in our browser. Let's visit http://localhost:8888/:
891917

892918
[[firefox-unable-to-connect-screenshot]]
893919
.Cannot connect on that port
894920
image::images/firefox-unable-to-connect.png["Firefox showing the 'Unable to connect' error"]
895921

922+
// CSANAD: Some more specific instructions were missing. We didn't specify the address.
923+
// Based on the following text I think it's supposed to be
924+
// http://localhost:8888 here but of course, it would fail with any other port as well.
896925

897926
Now let's take another look at the output from our `docker run`. Here's what appeared right at the end:
898927

@@ -903,8 +932,10 @@ Starting development server at http://127.0.0.1:8000/
903932
Quit the server with CONTROL-C.
904933
----
905934

906-
Aha! We notice that we're using the wrong port, `8000` instead of the `8888`
935+
Aha! We notice that we're using the wrong port, the default `8000` instead of the `8888`
907936
that we specified in the `TEST_SERVER` env var.
937+
// CSANAD: since we haven't specified :8000 explicitly either, maybe this sentence is
938+
// clearer with this extra word "default".
908939

909940
Let's fix that by amending the `CMD` instruction in the Dockerfile:
910941

0 commit comments

Comments
 (0)