Docker container failed to start at subsequence

First, i have a mariadb image from my private repository

Then I create two containers using that image inside docker compose file like these:


  gptbot_database:
    image: yukari/privatepj:gptbot
    container_name: gptbot_database
    ports:
      - 3307:3306
    restart: unless-stopped
    tty: true
    volumes:
      - gptbot_database_volume:/var/lib/mysql


  gptbot_database_2:
    image: yukari/privatepj:gptbot
    container_name: gptbot_database_2
    ports:
      - 3308:3306
    restart: unless-stopped
    tty: true
    volumes:
      - gptbot_database_volume:/var/lib/mysql

volumes:
  gptbot_database_volume:
    driver: local
    driver_opts:
      type: none
      o: bind

I expected it should start normally but in the end. the second one always failed to start service mariadb. So after that, i did split the volume into two separated volumes.


  gptbot_database:
    image: yukari/privatepj:gptbot
    container_name: gptbot_database
    ports:
      - 3307:3306
    restart: unless-stopped
    tty: true
    volumes:
      - gptbot_database_volume:/var/lib/mysql


  gptbot_database_2:
    image: yukari/privatepj:gptbot
    container_name: gptbot_database_2
    ports:
      - 3308:3306
    restart: unless-stopped
    tty: true
    volumes:
      - gptbot_database_volume_2:/var/lib/mysql

volumes:
  gptbot_database_volume:
    driver: local
    driver_opts:
      type: none
      o: bind

  gptbot_database_volume_2:
    driver: local
    driver_opts:
      type: none
      o: bind

Then i run docker compose down and then remove all images and containers. then run docker compose up again. but this time two of the containers failed. I can’t tell why

Host OS: Debian 11
Docker version: 1.43 (client & server)
More background info: docker logs return Starting Mariadb . . . . . . . . . . . . . . . . . . . failed

You can’t run two databases from the same database files, that’s a recipe for disaster.

I think the use of tty: true is very unusual for a database. From ChatGPT:

Setting tty: true allocates a pseudo-TTY for the service container. Essentially, this means the container is attached to a terminal, allowing it to accept input and display output as if it were a terminal.

Not sure if your complicated looking volume config is correct. Either you use a Docker volume managed by Docker (doc) or use a bind mount (partly doc) of a folder on the host. I recommend to simplify, the defaults are usually fine.

I did separate it and it still bug. I don’t know why. The database container only log one line “Start… failed”

You use a private image and get an unhelpful error message - how should we help?

Try to start your container without volumes to see if its generally working.

If docker logs … is not helpful maybe you should check if you can set some kind of verbose-flags.

1 Like