|
1 | | -## Run Container |
| 1 | +## Run a Container |
2 | 2 |
|
3 | 3 | The first step in running any application on Docker is to run a container from an image. There are plenty of images available from the official Docker registry (aka https://hub.docker.com[Docker Hub]). To run any of them, you just have to ask the Docker Client to run it. The client will check if the image already exists on Docker Host. If it exists then it'll run it, otherwise the host will download the image and then run it. |
4 | 4 |
|
@@ -200,8 +200,54 @@ Now we're ready to test http://dockerhost:8080 again. This works with the expose |
200 | 200 | .Welcome WildFly |
201 | 201 | image::plain-wildfly1.png[] |
202 | 202 |
|
| 203 | +### Stop Container |
| 204 | + |
| 205 | +. Stop a specific container: |
| 206 | ++ |
| 207 | +[source, text] |
| 208 | +---- |
| 209 | +docker stop <CONTAINER ID> |
| 210 | +---- |
| 211 | ++ |
| 212 | +. Stop all the running containers |
| 213 | ++ |
| 214 | +[source, text] |
| 215 | +---- |
| 216 | +docker stop $(docker ps -q) |
| 217 | +---- |
| 218 | ++ |
| 219 | +. Stop only the exited containers |
| 220 | ++ |
| 221 | +[source, text] |
| 222 | +---- |
| 223 | +docker ps -a -f "exited=-1" |
| 224 | +---- |
| 225 | + |
| 226 | +### Remove Container |
| 227 | + |
| 228 | +. Remove a specific container: |
| 229 | ++ |
| 230 | +[source, text] |
| 231 | +---- |
| 232 | +docker rm 0bc123a8ece0 |
| 233 | +---- |
| 234 | ++ |
| 235 | +. Remove containers meeting a regular expression |
| 236 | ++ |
| 237 | +[source, text] |
| 238 | +---- |
| 239 | +docker ps -a | grep wildfly | awk '{print $1}' | xargs docker rm |
| 240 | +---- |
| 241 | ++ |
| 242 | +. Remove all containers, without any criteria |
| 243 | ++ |
| 244 | +[source, text] |
| 245 | +---- |
| 246 | +docker rm $(docker ps -aq) |
| 247 | +---- |
| 248 | + |
203 | 249 | [[Enabling_WildFly_Administration]] |
204 | | -### Enabling WildFly Administration |
| 250 | +### Enable WildFly Administration |
205 | 251 |
|
206 | 252 | Default WildFly image exposes only port 8080 and thus is not available for administration using either the CLI or Admin Console. Lets expose the ports in different ways. |
207 | 253 |
|
@@ -294,51 +340,3 @@ In this case, Docker port mapping will be shown as: |
294 | 340 | 8080/tcp -> 0.0.0.0:8080 |
295 | 341 | 9990/tcp -> 0.0.0.0:9990 |
296 | 342 | ---- |
297 | | - |
298 | | -### Stop and Remove Container |
299 | | - |
300 | | -#### Stop Container |
301 | | - |
302 | | -. Stop a specific container: |
303 | | -+ |
304 | | -[source, text] |
305 | | ----- |
306 | | -docker stop <CONTAINER ID> |
307 | | ----- |
308 | | -+ |
309 | | -. Stop all the running containers |
310 | | -+ |
311 | | -[source, text] |
312 | | ----- |
313 | | -docker stop $(docker ps -q) |
314 | | ----- |
315 | | -+ |
316 | | -. Stop only the exited containers |
317 | | -+ |
318 | | -[source, text] |
319 | | ----- |
320 | | -docker ps -a -f "exited=-1" |
321 | | ----- |
322 | | - |
323 | | -#### Remove Container |
324 | | - |
325 | | -. Remove a specific container: |
326 | | -+ |
327 | | -[source, text] |
328 | | ----- |
329 | | -docker rm 0bc123a8ece0 |
330 | | ----- |
331 | | -+ |
332 | | -. Remove containers meeting a regular expression |
333 | | -+ |
334 | | -[source, text] |
335 | | ----- |
336 | | -docker ps -a | grep wildfly | awk '{print $1}' | xargs docker rm |
337 | | ----- |
338 | | -+ |
339 | | -. Remove all containers, without any criteria |
340 | | -+ |
341 | | -[source, text] |
342 | | ----- |
343 | | -docker rm $(docker ps -aq) |
344 | | ----- |
0 commit comments