<jupyter_start><jupyter_text>Docker Exercise 01In this exercise we'll look at the basics of running containers Verify the docker installOnce installed, check if Docker is working properly:<jupyter_code>%%bash
docker info<jupyter_output><empty_output><jupyter_text>Don't worry if you are overwhelmed by the details in the output. You are just starting out :) To make sure that your user has been added to `docker` group, run the following command and expect no errors and the `docker` group listed:<jupyter_code>%%bash
groups<jupyter_output><empty_output><jupyter_text>Try running a hello world container`docker run hello-world`<jupyter_code>%%bash
docker run hello-world<jupyter_output><empty_output><jupyter_text>Show the running containers (if any)`docker ps`<jupyter_code>%%bash
docker ps<jupyter_output><empty_output><jupyter_text>Notice that using `docker ps` does not return the information about the `hello-world` image. This is since the `hello-world` image is no longer running. To return the information about a stopped image, you can use `docker ps --all` or `docker ps -a` for short.<jupyter_code>%%bash
docker ps --all<jupyter_output><empty_output><jupyter_text>When using a "cattle" (vs "pets") approach to manage your Docker containers, it is useful to run `docker ps -aq` which lists just the container IDs. If you know how to use `xargs` you can combine the output of `docker ps -aq` with `xargs` to automate container management.<jupyter_code>%%bash
docker ps -aq<jupyter_output><empty_output><jupyter_text>Similarly `docker ps -lq` lists the most recently used container ID.<jupyter_code>%%bash
docker ps -lq<jupyter_output><empty_output><jupyter_text>Stopping a running container`docker stop CONTAINER_ID`If a container is running, you can stop it (shown using the `Exited` status) using `docker stop`. Since your `hello-world` image already exited and is stopped, you can stop it but it will have no effect. Try it:<jupyter_code>%%bash
docker stop $(docker ps -lq)<jupyter_output><empty_output><jupyter_text>Removing a stopped containerIf a container is stopped (exited), you can remove it and free up disk space used by the container instance using `docker rm`.<jupyter_code>%%bash
docker rm $(docker ps -lq)<jupyter_output><empty_output><jupyter_text>Notice that once you have removed a container it disappears in the `docker ps --all` list or `docker ps -a` for short.<jupyter_code>%%bash
docker ps -a<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.08472505091649694, 'fraction_numerical': 0.000814663951120163, 'mean_word_length': 6.4650455927051675, 'pattern_counts': {'":': 0, '<': 41, '<?xml version=': 0, '>': 41, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '10', 'dir': 'jupyter-structured-clean-dedup', 'id': '464025', 'license': 'Apache-2.0', 'n_tokens_mistral': 795, 'n_tokens_neox': 734, 'n_words': 296, 'path': 'doc0/Exercise01/Exercise01_Solution.ipynb', 'repo_name': 'nsingh216/edu', 'size': '2455'}