|
@@ -9,7 +9,7 @@ Python Web App
|
|
|
|
|
|
.. include:: example_header.inc
|
|
|
|
|
|
-While using Dockerfiles is the preffered way to create maintainable
|
|
|
+While using Dockerfiles is the preferred way to create maintainable
|
|
|
and repeatable images, its useful to know how you can try things out
|
|
|
and then commit your live changes to an image.
|
|
|
|
|
@@ -62,8 +62,8 @@ Commit the container to create a new image
|
|
|
------------------------------------------
|
|
|
|
|
|
Save the changes we just made in the container to a new image called
|
|
|
-``/builds/github.com/hykes/helloflask/master``. You now have 3 different
|
|
|
-ways to refer to the container, name, short-id ``c8b2e8228f11``, or
|
|
|
+``/builds/github.com/shykes/helloflask/master``. You now have 3 different
|
|
|
+ways to refer to the container: name ``pybuilder_run``, short-id ``c8b2e8228f11``, or
|
|
|
long-id ``c8b2e8228f11b8b3e492cbf9a49923ae66496230056d61e07880dc74c5f495f9``.
|
|
|
|
|
|
.. code-block:: bash
|
|
@@ -76,12 +76,11 @@ Run the new image to start the web worker
|
|
|
-----------------------------------------
|
|
|
|
|
|
Use the new image to create a new container with
|
|
|
-network port 5000, and return the container ID and store in the
|
|
|
-``WEB_WORKER`` variable (rather than naming a container/image, you can use the ID's).
|
|
|
+network port 5000 mapped to a local port
|
|
|
|
|
|
.. code-block:: bash
|
|
|
|
|
|
- $ WEB_WORKER=$(sudo docker run -d -p 5000 /builds/github.com/hykes/helloflask/master /usr/local/bin/runapp)
|
|
|
+ $ sudo docker run -d -p 5000 --name web_worker /builds/github.com/shykes/helloflask/master /usr/local/bin/runapp
|
|
|
|
|
|
|
|
|
- **"docker run -d "** run a command in a new container. We pass "-d"
|
|
@@ -94,7 +93,7 @@ network port 5000, and return the container ID and store in the
|
|
|
View the container logs
|
|
|
-----------------------
|
|
|
|
|
|
-View the logs for the new container using the ``WEB_WORKER`` variable, and
|
|
|
+View the logs for the new ``web_worker`` container and
|
|
|
if everything worked as planned you should see the line ``Running on
|
|
|
http://0.0.0.0:5000/`` in the log output.
|
|
|
|
|
@@ -103,7 +102,7 @@ terminal and continue with the example while watching the result in the logs.
|
|
|
|
|
|
.. code-block:: bash
|
|
|
|
|
|
- $ sudo docker logs -f $WEB_WORKER
|
|
|
+ $ sudo docker logs -f web_worker
|
|
|
* Running on http://0.0.0.0:5000/
|
|
|
|
|
|
|
|
@@ -118,7 +117,7 @@ should see the line ``Hello world!`` inside of your console.
|
|
|
|
|
|
.. code-block:: bash
|
|
|
|
|
|
- $ WEB_PORT=$(sudo docker port $WEB_WORKER 5000 | awk -F: '{ print $2 }')
|
|
|
+ $ WEB_PORT=$(sudo docker port web_worker 5000 | awk -F: '{ print $2 }')
|
|
|
|
|
|
# install curl if necessary, then ...
|
|
|
$ curl http://127.0.0.1:$WEB_PORT
|
|
@@ -137,8 +136,8 @@ running, it will still be listed here with a status of 'Exit 0'.
|
|
|
|
|
|
.. code-block:: bash
|
|
|
|
|
|
- $ sudo docker stop $WEB_WORKER
|
|
|
- $ sudo docker rm $WEB_WORKER pybuilder_run
|
|
|
+ $ sudo docker stop web_worker
|
|
|
+ $ sudo docker rm web_worker pybuilder_run
|
|
|
$ sudo docker rmi /builds/github.com/shykes/helloflask/master shykes/pybuilder:latest
|
|
|
|
|
|
And now stop the running web worker, and delete the containers, so that we can
|