Docker-DCO-1.1-Signed-off-by: SvenDowideit <SvenDowideit@home.org.au> (github: SvenDowideit)
| ... | ... |
@@ -116,8 +116,8 @@ We can also use `docker inspect` to return the container's name. |
| 116 | 116 |
|
| 117 | 117 |
> **Note:** |
| 118 | 118 |
> Container names have to be unique. That means you can only call |
| 119 |
-> one container `web`. If you want to re-use a container name you must delete the |
|
| 120 |
-> old container with the `docker rm` command before you can create a new |
|
| 119 |
+> one container `web`. If you want to re-use a container name you must delete |
|
| 120 |
+> the old container with the `docker rm` command before you can create a new |
|
| 121 | 121 |
> container with the same name. As an alternative you can use the `--rm` |
| 122 | 122 |
> flag with the `docker run` command. This will delete the container |
| 123 | 123 |
> immediately after it stops. |
| ... | ... |
@@ -133,6 +133,11 @@ container, this one a database. |
| 133 | 133 |
Here we've created a new container called `db` using the `training/postgres` |
| 134 | 134 |
image, which contains a PostgreSQL database. |
| 135 | 135 |
|
| 136 |
+We need to delete the `web` container we created previously so we can replace it |
|
| 137 |
+with a linked one: |
|
| 138 |
+ |
|
| 139 |
+ $ docker rm -f web |
|
| 140 |
+ |
|
| 136 | 141 |
Now let's create a new `web` container and link it with our `db` container. |
| 137 | 142 |
|
| 138 | 143 |
$ sudo docker run -d -P --name web --link db:db training/webapp python app.py |