0

I'm on a Debian VPS on OVH cloud provider, running Docker.

Trying to make an apt update on the instance, I noticed that the disk of 40GB was full. What is quite surprising for an instance hosting 2 Wordpress blogs.

I tried to run:

sudo du -h /var/lib/docker/containers

One of the containers weight 27GB !

27G     /var/lib/docker/containers/1618df0(...)d6cc61e

However when I run:

docker container ls --size

The same container only weight 500MB

1618df0(...) 782c(...) "docker-entrypoint.s…" 10 months ago Up 10 months 80/tcp blog_wordpress_1 2B (virtual 545MB)

The Docker Compose is pretty simple:

wordpress:
    build:
      # call the Dockerfile in ./wordpress
      context: ./wordpress
    restart: always
    environment:
      # Connect WordPress to the database
      WORDPRESS_DB_HOST: db:xxxx
      WORDPRESS_DB_USER: xxxx
      WORDPRESS_DB_PASSWORD: xxxx
      WORDPRESS_DB_NAME: xxxx
    volumes:
      # save the content of WordPress an enable local modifications
      - ./wordpress/data:/var/www/html
    networks:
      - traefik
      - backend
    depends_on:
        - db
        - redis

The Dockerfile:

FROM wordpress

# printf statement mocks answering the prompts from the pecl install
RUN printf "\n \n" | pecl install redis && docker-php-ext-enable redis

RUN /etc/init.d/apache2 restart

Do you know what to investigate to understand this problem ?

Thanks

Xiiryo
  • 3,021
  • 5
  • 31
  • 48

1 Answers1

2

Ok, this was actually the logs... The logs are not counted by:

docker container ls --size

So I just truncated the logs, brutally:

sudo sh -c "truncate -s 0 /var/lib/docker/containers/*/*-json.log"

This solve the problem for a while.

For the long term, I added these lines to the Wordpress container's Docker Compose, then deleted and recreated the containers:

logging:
      options:
        max-size: "10m"
        max-file: "3"
Xiiryo
  • 3,021
  • 5
  • 31
  • 48