diff --git a/Dockerfile b/Dockerfile index e7ac0c2..c07033d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,7 +6,5 @@ RUN apt-get update \ && apt-get -y install cron \ && rm -rf /var/lib/apt/lists/* -RUN useradd test - # Run the command on container startup -CMD crontab -u test /home/test/cron/crontab-file && cron -f +CMD crontab /root/cron/crontab-file && cron -f diff --git a/crontab-file b/crontab-file index 09a22a1..78916bb 100644 --- a/crontab-file +++ b/crontab-file @@ -1 +1 @@ -* * * * * bash /test/cron/task.sh +* * * * * bash /root/cron/task.sh diff --git a/docker-compose.yml b/docker-compose.yml index e64da29..909f05b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,5 +4,5 @@ services: build: . volumes: - ./output:/output - - ./:/home/test/cron + - ./:/root/cron \ No newline at end of file diff --git a/output/out.txt b/output/out.txt index ffc3c4b..d4e9231 100644 --- a/output/out.txt +++ b/output/out.txt @@ -17,3 +17,4 @@ Hello World at Thu Nov 30 22:07:01 UTC 2023 Hello World at at at at at Thu Nov 30 22:08:01 UTC 2023 Hello World at at at at at Thu Nov 30 22:09:01 UTC 2023: /root Hello World at at at at at Thu Nov 30 22:10:01 UTC 2023: /root +Hello World at at at at at Fri Dec 1 21:51:01 UTC 2023: /root