1
0
Fork 0
Signed-off-by: Arnaud Morin <arnaud.morin@ovhcloud.com>
This commit is contained in:
Arnaud Morin 2022-01-08 23:55:35 +01:00
parent 30dbc29659
commit 1bfed12966
3 changed files with 13 additions and 9 deletions

View File

@ -12,3 +12,10 @@ Your job now will be to create 2 roles:
* one role for all tasks related to deploying nginx as a proxy * one role for all tasks related to deploying nginx as a proxy
* for this one, you must also use some variables as input parameters for both ports (80 and 8080 in the previous lessons) * for this one, you must also use some variables as input parameters for both ports (80 and 8080 in the previous lessons)
# Cleanup
Once you're done, destroy the demo docker:
```
docker stop demo
```

View File

@ -53,10 +53,9 @@ docker ps
``` ```
``` ```
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f9c03ce13b09 demo "/usr/sbin/sshd -D" 32 minutes ago Up 32 minutes 127.0.0.2:8080->8080/tcp, 127.0.0.2:2222->22/tcp demo
``` ```
So you see only one container running, named `demo`. So you see an empty list.
This is not your `debian` container, but the container used in the previous lesson.
Why the `debian` is not visible? Because it's not running anymore! Why the `debian` is not visible? Because it's not running anymore!
Q: what command can we use to retrieve all containers, including the stopped ones? Q: what command can we use to retrieve all containers, including the stopped ones?
@ -87,7 +86,7 @@ docker rm xxyy
Q: which parameter to `docker run` could we pass to automate the removal of the container after the execution? Q: which parameter to `docker run` could we pass to automate the removal of the container after the execution?
# Clean your environment # Clean your environment
Before continuing this training, destroy all running containers using `docker stop` and `docker rm`. Destroy also the `demo` container from previous lesson, we don't need it anymore. Before continuing this training, destroy all running containers using `docker stop` and `docker rm`.
# Real application # Real application
It's now time to deploy a real application. It's now time to deploy a real application.
@ -122,11 +121,9 @@ Start now a container from your image:
``` ```
docker run yourname/demo-flask docker run yourname/demo-flask
``` ```
This will start a container with the demo-flask, but the app will not be accessible from outside. This will start a container with the demo-flask, but the app will not be accessible from outside yet.
You remember that you installed a `nginx` proxy to access the previous `demo` container? Q: find the good `docker run` command to run your container in background and expose the port so that you can access your app from internet.
Q: find the good `docker run` command to run your container in background and expose the port locally so the `nginx` proxy reach your application.
Congrats, you're done with docker101! Congrats, you're done with docker101!

View File

@ -80,6 +80,6 @@ docker build -t demo .
#systemctl restart nginx #systemctl restart nginx
title.print "Starting demo container" title.print "Starting demo container"
docker run -d -p 127.0.0.2:8080:8080 -p 127.0.0.2:2222:22 --name demo demo docker run -d --rm -p 127.0.0.2:8080:8080 -p 127.0.0.2:2222:22 --name demo demo
title.print "Done" title.print "Done"