1

Running a staging server using docker-componse.yml configuration, which has a MySQL service running with the following configuration

services:
  database:
    image: mysql:8.0.17
    container_name: qcg__staging__database
    command: --default-authentication-plugin=mysql_native_password
    restart: always
    volumes:
      - qcg7_staging_db:/var/lib/mysql
    environment:
      - MYSQL_DATABASE=app_staging
      - MYSQL_USER=app_staging
      - MYSQL_PASSWORD=app_staging
      - MYSQL_ROOT_PASSWORD=app_staging
    ports:
      - 3306:3306

volumes:
  qcg7_staging_db:

Every time a code is pushed to the staging server, the docker containers are stopped and restarted using the following command

docker-compose down --remove-orphans
docker-compose -f docker-compose-staging.yml up --build -d

After few days of usages, the volume usages of the database reach 40GB which the actual data size in the database is 2.3 GiB

# docker system df -v

Local Volumes space usage:

VOLUME NAME                         LINKS     SIZE
qcg-backend_qcg7_staging_db         1         20.06GB

The output of Workbench database inspect

enter image description here

Anuj TBE
  • 111
  • 3
  • So what is taking up all the space? You can just go and look. – Michael Hampton Aug 19 '21 at 01:51
  • @MichaelHampton where to look? The database size is 2.3 GB and the volume size is 20 GB. Not sure where to check. – Anuj TBE Aug 19 '21 at 05:14
  • Look at the actual sizes of the actual files. Use tools like `du` and `ls`. – Michael Hampton Aug 19 '21 at 05:20
  • I ran into the same issue yesterday. I found that [MySQL's Binary Logs](https://dev.mysql.com/doc/refman/8.0/en/binary-log.html) were making up the majority of my volume size. As I don't need such functionality, I've added `"--disable-log-bin"` to the service command. – halloei Oct 05 '21 at 15:37

0 Answers0