@@ -11,64 +11,6 @@ If you are working your way through the user guide, you just built and ran a
11
11
simple application. You've also built in your own images. This section teaches
12
12
you how to network your containers.
13
13
14
- ## Name a container
15
-
16
- You've already seen that each container you create has an automatically
17
- created name; indeed you've become familiar with our old friend
18
- ` nostalgic_morse ` during this guide. You can also name containers
19
- yourself. This naming provides two useful functions:
20
-
21
- * You can name containers that do specific functions in a way
22
- that makes it easier for you to remember them, for example naming a
23
- container containing a web application ` web ` .
24
-
25
- * Names provide Docker with a reference point that allows it to refer to other
26
- containers. There are several commands that support this and you'll use one in an exercise later.
27
-
28
- You name your container by using the ` --name ` flag, for example launch a new container called web:
29
-
30
- $ docker run -d -P --name web training/webapp python app.py
31
-
32
- Use the ` docker ps ` command to check the name:
33
-
34
- $ docker ps -l
35
-
36
- CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
37
- aed84ee21bde training/webapp:latest python app.py 12 hours ago Up 2 seconds 0.0.0.0:49154->5000/tcp web
38
-
39
- You can also use ` docker inspect ` with the container's name.
40
-
41
- $ docker inspect web
42
-
43
- [
44
- {
45
- "Id": "3ce51710b34f5d6da95e0a340d32aa2e6cf64857fb8cdb2a6c38f7c56f448143",
46
- "Created": "2015-10-25T22:44:17.854367116Z",
47
- "Path": "python",
48
- "Args": [
49
- "app.py"
50
- ],
51
- "State": {
52
- "Status": "running",
53
- "Running": true,
54
- "Paused": false,
55
- "Restarting": false,
56
- "OOMKilled": false,
57
- ...
58
-
59
- Container names must be unique. That means you can only call one container
60
- ` web ` . If you want to re-use a container name you must delete the old container
61
- (with ` docker rm ` ) before you can reuse the name with a new container. Go ahead and stop and remove your old ` web ` container.
62
-
63
- $ docker stop web
64
-
65
- web
66
-
67
- $ docker rm web
68
-
69
- web
70
-
71
-
72
14
## Launch a container on the default network
73
15
74
16
Docker includes support for networking containers through the use of ** network
@@ -259,4 +201,4 @@ The `ping` shows it is contacting a different IP address, the address on the `my
259
201
260
202
## Next steps
261
203
262
- Now that you know how to network containers, see [ how to manage data in containers] ( dockervolumes.md ) .
204
+ Now that you know how to network containers, see [ how to manage data in containers] ( dockervolumes.md ) .
0 commit comments