[RESOLVED] Mysql in catalogue: why have volume in sidekick?

Hi,
I’m looking at the mysql stack in the catalogue, and I can’t understand why the volume is set up in the sidekick and then the mysql service uses “volumes_from” the sidekick.

Why add another container + another linux distro (busybox) just to add a volume which could be mapped in the main mysql container?

Thanks in advance,
Andy

Hi,
Sorry, just wanted to provide details. Here is the relevant sections of the mysql docker compose:

mysql:
    image: mariadb:10.3.0
    environment:
      MYSQL_DATABASE: XXX
      MYSQL_PASSWORD: XXX
      MYSQL_ROOT_PASSWORD: XXX
      MYSQL_USER: XXX
    stdin_open: true
    tty: true
    volumes_from:
    - mysql-data
    ports:
    - 4407:3306/tcp
    labels:
      io.rancher.scheduler.affinity:host_label: database=yes
      io.rancher.sidekicks: mysql-data
      test: test
  mysql-data:
    image: busybox
    volumes:
    - /mnt/XXX/database:/var/lib/mysql
    labels:
      io.rancher.scheduler.affinity:host_label: database=yes
      io.rancher.container.start_once: 'true'

So the mysql-data sidekick launches once, and sets up the volume. It seems unnecessary to create a seperate container for this?

Regards,
Andy

This is called a “data-only container” and is how you did “volumes” in Docker before volumes existed. Changing it now would break in existing users of the catalog item.

Ah thanks Vincent. That explains my confusion. Appreciate the quick response.

Andy