From b6893764c9887357a154b2efdbd5199eba9086e6 Mon Sep 17 00:00:00 2001 From: Bence Sztankovszky Date: Mon, 14 Dec 2020 17:43:21 +0100 Subject: [PATCH] Add Dockerfile to enable running in Docker --- Dockerfile | 9 +++++++++ README.md | 20 ++++++++++++++++---- 2 files changed, 25 insertions(+), 4 deletions(-) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..044400d --- /dev/null +++ b/Dockerfile @@ -0,0 +1,9 @@ +FROM python:2 +RUN pip install pip install faker \ + numpy \ + pytz \ + tzlocal +COPY apache-fake-log-gen.py / +COPY requirements.txt / +COPY LICENSE / +ENTRYPOINT ["python","/apache-fake-log-gen.py"] \ No newline at end of file diff --git a/README.md b/README.md index 6d5bee7..247ab45 100644 --- a/README.md +++ b/README.md @@ -12,12 +12,12 @@ It utilizes the excellent [Faker](https://github.com/joke2k/faker/) library to g Generate a single log line to STDOUT ``` -$ python apache-fake-log-gen.py +$ python apache-fake-log-gen.py ``` Generate 100 log lines into a .log file ``` -$ python apache-fake-log-gen.py -n 100 -o LOG +$ python apache-fake-log-gen.py -n 100 -o LOG ``` Generate 100 log lines into a .gz file at intervals of 10 seconds @@ -27,10 +27,10 @@ $ python apache-fake-log-gen.py -n 100 -o GZ -s 10 Infinite log file generation (useful for testing File Tail Readers) ``` -$ python apache-fake-log-gen.py -n 0 -o LOG +$ python apache-fake-log-gen.py -n 0 -o LOG ``` -Prefix the output filename +Prefix the output filename ``` $ python apache-fake-log-gen.py -n 100 -o LOG -p WEB1 ``` @@ -57,6 +57,18 @@ optional arguments: Sleep this long between lines (in seconds) ``` +## Usage in Docker + +Build the image: +``` +docker build -t apache-fake-log-gen . +``` + +Run the application, and provide application command line arguments as Docker CMD args: +``` +docker run --rm apache-fake-log-gen -n 10 -s 1 +``` +NOTE: `-o LOG` option does not work in this case. ## Requirements * Python 2.7