skip to Main Content

I have an WordPress Project running with docker-compose. I am hosting the project on Digitalocean and have an issue with the space. The client recognised he couldn’t upload new images after days/weeks. I executed docker system prune --all and was able to clear some space and upload new media. But after a little time the disk space is full again. /var/lib/docker/overlay2 is like 25GB. What is this & how can i fix this issue?

Update 1: docker system prune --all now gives me Total reclaimed space: 0B

Update 2: I was able to upload some media and change page content again after executing the following commands. The Problem is still that this fix only lasts for some hours and after hours nothing is changeable anymore.

docker kill $(docker ps -q)
docker system prune
sudo service apache2 stop
docker-compose up -d

Update 3: I investigated a little bit and found a 17GB logfile inside /var/lib/docker/containers/ID/HASH-json.log

How can i limit this file size?

Space on server:

Screenshot

This is how my docker-compose.yml looks like:


services:
  db:
    image: mysql:5.7
    volumes:
      - db_data:/var/lib/mysql
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: xx
      MYSQL_DATABASE: xx
      MYSQL_USER: xx
      MYSQL_PASSWORD: xx

  wordpress:
    depends_on:
      - db
    image: wordpress:latest
    volumes:
      - wordpress_data:/var/www/html
      - ./uploads.ini:/usr/local/etc/php/conf.d/uploads.ini
      - ./my_theme:/var/www/html/wp-content/themes/my_theme
    ports:
      - "80:80"
    restart: always
    environment:
      WORDPRESS_DB_HOST: db:3306
      WORDPRESS_DB_USER: xx
      WORDPRESS_DB_PASSWORD: xx
      WORDPRESS_DB_NAME: xx

  phpmyadmin:
    image: corbinu/docker-phpmyadmin
    links:
      - db:mysql
    ports:
      - 8181:80
    environment:
      MYSQL_USERNAME: xx
      MYSQL_ROOT_PASSWORD: xx
      MYSQL_PORT_3306_TCP_ADDR: db
volumes:
  db_data: {}
  wordpress_data: {}```

2

Answers


  1. Chosen as BEST ANSWER

    I fixed this issue by setting a max size limit for logging files.

    version: "3.9"
    
    services:
      db:
        image: mysql:5.7
        volumes:
          - db_data:/var/lib/mysql
        restart: always
        logging:
            driver: "json-file"
            options:
              max-size: "10m"
              max-file: "5"
        environment:
          MYSQL_ROOT_PASSWORD: xx
          MYSQL_DATABASE: xx
          MYSQL_USER: xx
          MYSQL_PASSWORD: xx
    
      wordpress:
        depends_on:
          - db
        image: wordpress:latest
        volumes:
          - wordpress_data:/var/www/html
          - ./uploads.ini:/usr/local/etc/php/conf.d/uploads.ini
          - ./xxx:/var/www/html/wp-content/themes/xx
        ports:
          - "80:80"
        restart: always
        logging:
            driver: "json-file"
            options:
              max-size: "10m"
              max-file: "5"
        environment:
          WORDPRESS_DB_HOST: db:3306
          WORDPRESS_DB_USER: xx
          WORDPRESS_DB_PASSWORD: xx
          WORDPRESS_DB_NAME: xx
    
      phpmyadmin:
        image: corbinu/docker-phpmyadmin
        links:
          - db:mysql
        ports:
          - 8181:80
        environment:
          MYSQL_USERNAME: xxx
          MYSQL_ROOT_PASSWORD: xxx
          MYSQL_PORT_3306_TCP_ADDR: db
    volumes:
      db_data: {}
      wordpress_data: {}
    

  2. The /dev/vda1, which hosts docker containers too, is full, so your overlays cannot grow up.

    I suggest you to:

    1. Mount an external disk/partition as data storage.
    2. Create volumes, data and db too, as a binding to the above storage.
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search