GETTING STARTED Since we already did "Hello, World!" in the material let's do something else. Start 3 containers from an image that does not automatically exit (such as nginx) in detached mode. Stop two of the containers and leave one container running. Submit the output for docker ps -a which shows 2 stopped containers and one running.
iemafzal~docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f424fb367366 redis "docker-entrypoint.s…" 9 seconds ago Up 9 seconds 6379/tcp zealous_visvesvaraya
a5d9d31e1fd3 httpd "httpd-foreground" 18 seconds ago Up 17 seconds 80/tcp dazzling_banzai
57b67b8f1b13 nginx "/docker-entrypoint.…" 32 seconds ago Up 32 seconds 80/tcp intelligent_wilson
iemafzal~docker stop f424fb367366 a5d9d31e1fd3
f424fb367366
a5d9d31e1fd3
iemafzal~docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f424fb367366 redis "docker-entrypoint.s…" 52 seconds ago Exited (0) 5 seconds ago zealous_visvesvaraya
a5d9d31e1fd3 httpd "httpd-foreground" About a minute ago Exited (0) 4 seconds ago dazzling_banzai
57b67b8f1b13 nginx "/docker-entrypoint.…" About a minute ago Up About a minute 80/tcp intelligent_wilson
iemafzal~
![Docker 1 1](https://private-user-images.githubusercontent.com/136967348/326202951-eea86783-582a-4ac7-87fd-1eeeb4ff5a70.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQ5NzYwMTMsIm5iZiI6MTcyNDk3NTcxMywicGF0aCI6Ii8xMzY5NjczNDgvMzI2MjAyOTUxLWVlYTg2NzgzLTU4MmEtNGFjNy04N2ZkLTFlZWViNGZmNWE3MC5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwODI5JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDgyOVQyMzU1MTNaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT00OTQ1NjkxNDNmNzkyMTM1OGMxOWM3NDgzMWQ4N2ViOTM5MmY1MmUxZDA4MWUwNDkzMWRhMWFmNDU4YTFjMzAwJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.-ISNao-x79CY9-CgNmfCfl0JSDWtzcuEy9jhlU4pZgQ)
CLEANUP
We have containers and an image that are no longer in use and are taking up space. Running docker ps -a and docker image ls will confirm this. Clean the Docker daemon by removing all images and containers. Submit the output for docker ps -a and docker image ls
iemafzal~docker stop f424fb367366 a5d9d31e1fd3
f424fb367366
a5d9d31e1fd3
iemafzal~docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f424fb367366 redis "docker-entrypoint.s…" 52 seconds ago Exited (0) 5 seconds ago zealous_visvesvaraya
a5d9d31e1fd3 httpd "httpd-foreground" About a minute ago Exited (0) 4 seconds ago dazzling_banzai
57b67b8f1b13 nginx "/docker-entrypoint.…" About a minute ago Up About a minute 80/tcp intelligent_wilson
iemafzal~docker rm f4 a5 57
f4
a5
57
iemafzal~docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
cf4af5cbbf78 httpd "httpd-foreground" 58 seconds ago Exited (0) 43 seconds ago competent_davinci
1fa66b6b340a nginx "/docker-entrypoint.…" About a minute ago Exited (0) 44 seconds ago vigorous_bassi
131e3dc4c7ce redis "docker-entrypoint.s…" About a minute ago Exited (0) 44 seconds ago laughing_chatelet
iemafzal~docker rm cf 1f 131
cf
1f
131
iemafzal~docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
iemafzal~docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
iemafzal~
![Docker 1 2](https://private-user-images.githubusercontent.com/136967348/326202968-d77a77c0-6e80-450a-be81-ca362e856425.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQ5NzYwMTMsIm5iZiI6MTcyNDk3NTcxMywicGF0aCI6Ii8xMzY5NjczNDgvMzI2MjAyOTY4LWQ3N2E3N2MwLTZlODAtNDUwYS1iZTgxLWNhMzYyZTg1NjQyNS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwODI5JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDgyOVQyMzU1MTNaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT01ZDIwMTljODQ3MTEzZWJmYmJmNjU5YTcwNDZiOTYzY2JmMzRjN2U3OWE3NDQ1NzRmNGJjN2U3MmU4ODdiNTQ0JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.k2fQuDFTzwYWPlnXL8fUBepMKxyKZQqPLxaI2a9P2_Q)