<commit_before># docker-log-example
This example will show how to view log files of an app running inside a Docker container, using "Volumes". The application here is just a shell script that runs in an infinite loop echoing a string to /var/log/myapp.log

## Building and running the image
First of clone the repo or download the needed files directly then run
   
    docker build -t myimage/logger .

Now you should see a new image with the name you specified with the option -t

    docker images

Let's run it
    
    docker run -d --name "logger" myimage/logger

The option **-d** tells docker to run in the background, in this case it is needed since the "app" runs infinitely and would not give STDIN back.

If everything went well there is a new container called "logger" running the command specified in the Dockerfile. Verify with

    docker ps

## Where are the logs?
Containers are not virtual machines so we can't just easily SSH into the environment, **BUT** there are other ways. In the Dockerfile you see a *VOLUMES* instruction that points to */var/log* (obviously, where our logs reside).

    docker inspect -f {{.Volumes}} logger # See where that volume is mapped in the file system

Volumes are not exclusive to containers. Every Docker container is able to connect to a Volume of another container. So let's see how this works by spawning a new one.

    docker run -t -i --volumes-from=logger --name logview ubuntu:14.04 /bin/bash # running Ubuntu here because it is the base immage

The option **--volumes-from=** does the magic of connecting the Volumes from another container. After running the above command you should have a shell and can access the logs of our "application".
<commit_msg>Fixed typo<commit_after># docker-log-example
This example will show how to view log files of an app running inside a Docker container, using "Volumes". The application here is just a shell script that runs in an infinite loop echoing a string to /var/log/myapp.log

## Building and running the image
First of clone the repo or download the needed files directly then run
   
    docker build -t myimage/logger .

Now you should see a new image with the name you specified with the option -t

    docker images

Let's run it
    
    docker run -d --name "logger" myimage/logger

The option **-d** tells docker to run in the background, in this case it is needed since the "app" runs infinitely and would not give STDIN back.

If everything went well there is a new container called "logger" running the command specified in the Dockerfile. Verify with

    docker ps

## Where are the logs?
Containers are not virtual machines so we can't just easily SSH into the environment, **BUT** there are other ways. In the Dockerfile you see a *VOLUME* instruction that points to */var/log* (obviously, where our logs reside).

    docker inspect -f {{.Volumes}} logger # See where that volume is mapped in the file system

Volumes are not exclusive to containers. Every Docker container is able to connect to a Volume of another container. So let's see how this works by spawning a new one.

    docker run -t -i --volumes-from=logger --name logview ubuntu:14.04 /bin/bash # running Ubuntu here because it is the base immage

The option **--volumes-from=** does the magic of connecting the Volumes from another container. After running the above command you should have a shell and can access the logs of our "application".

{'fraction_non_alphanumeric': 0.05529685681024447, 'fraction_numerical': 0.002328288707799767, 'mean_word_length': 3.708219178082192, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3560857', 'n_tokens_mistral': 912, 'n_tokens_neox': 852, 'n_words': 545}