desktop-linux icon indicating copy to clipboard operation
desktop-linux copied to clipboard

docker on majaro / arch linux if use ulimits , its delete the database after down

Open murilolivorato opened this issue 1 year ago • 0 comments

Description

hello , I am using manjaro / arch linux distro . I created a docker-compose with mysql , it was consuming to much of my memory to almost 15 M only with mysql with docker . and the system ( Majaro linux ) was consuming 5 M . at the total , my computer was consuming 20 M . to height , so , I did seach , and I discovered a topic in a forum , that had arch linux developers , that found a solution .

they added this to the docker-compose.yaml unde mysql sever -

    ulimits:
      nofile:
        soft: 1048576
        hard: 1048576

it worked, and now the system + docker was consuming 10 M , much better .

but, now started a new problem . when I stop the service , with -

docker-compose down

and start again with

docker-compose up

sometimes , my database is destroyed . and I have to populate it again .

I tried to increase the limit to -

      ulimits:
      nofile:
        soft: 400048576
        hard: 400048576

but it still destroying some times the database.

my entire docker-compose is like this -

networks:
  my_database:
services:
  mysql:
    image: mysql:8.0.1
    restart: unless-stopped
    tty: true
    container_name: yep_mysql
    env_file:
      - mysql/.env
    ports:
      - 3306:3306
    networks:
      - my_database
    volumes:
      - /opt/mysql_data:/var/lib/mysql
    ulimits:
      nofile:
        soft: 400048576
        hard: 400048576

if some one can help , thanks

Reproduce

docker-compose up -d

Expected behavior

it is deleting the database

docker version

docker version - 26.1.4,
docker compose version - 2.27.1

docker info

CPUs: 32
 Total Memory: 62.61GiB
Debug Mode: false
 Experimental: false

Diagnostics ID

32423

Additional Info

networks:
  my_database:
services:
  mysql:
    image: mysql:8.0.1
    restart: unless-stopped
    tty: true
    container_name: yep_mysql
    env_file:
      - mysql/.env
    ports:
      - 3306:3306
    networks:
      - my_database
    volumes:
      - /opt/mysql_data:/var/lib/mysql
    ulimits:
      nofile:
        soft: 400048576
        hard: 400048576

murilolivorato avatar Aug 04 '24 18:08 murilolivorato