'Why my docker container starts printing the historical logs?

When I start a container, the first thing it does is print in the terminal all the loggings generated since the first execution of the container (1 month ago until now).

How can I stop this from happening?

DOCKERFILE

FROM python:3.8-slim-buster

WORKDIR /worker_server

RUN apt-get update
RUN apt-get install ffmpeg libsm6 libxext6  -y

COPY requirements.txt requirements.txt
RUN pip3 install -r requirements.txt

COPY . .

CMD [ "python3", "server.py"]

PARTIAL Docker compose

modelserver:
 image: docker_image_tester/workerserver
 build: ./worker_service
 environment:
   - RABBITMQ_HOST=rabbitmq
   - DEEPSTACK_HOST=deepstack
   - CASSANDRA_CLUSTER=ip_location
   - HEART_BEAT_TIMEOUT=120
   - BLOCKED_CONNECTION_TIMEOUT=300
 networks:
   - micro_network
 depends_on:
   - rabbitmq
 restart: on-failure
 links:
   - deepstack
 deploy:
   replicas: 1
   restart_policy:
     condition: on-failure

LOGGER server code:

logging.captureWarnings(True)
LOGGER = logging.getLogger(__name__)
logging.basicConfig(
 filename='log_file_name.log',
 level=logging.ERROR, 
 format= '[%(asctime)s] {%(pathname)s:%(lineno)d} %(levelname)s - %(message)s',
 datefmt='%H:%M:%S'
 )
coloredlogs.install(level='INFO')


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source