Coder Social home page Coder Social logo

Comments (14)

thaJeztah avatar thaJeztah commented on August 15, 2024 43

I see you're bind-mounting a directory (/srv/librenms/db), is this the first time you run a container using this directory? Was the directory empty before running the container? (the image will only initialize the database if the data directory is empty; see this line in the entrypoint script; https://github.com/docker-library/mariadb/blob/cc686f56875aa84d135bb89de6ca50385211bdab/10.1/docker-entrypoint.sh#L36)

from mariadb-docker.

danielecr avatar danielecr commented on August 15, 2024 11

sorry, still checking this. It looks like database initialization take looooooong time, more than what i expected.

Anyway I hope it is usefull my comment to anyone facing this problem with little patience like me

from mariadb-docker.

gezichenshan avatar gezichenshan commented on August 15, 2024 1

I checked this solution and saved my life. He changed the volumn name and worked! The answer says it might the data layer might not be recreated.

Could you give some detailed info?

from mariadb-docker.

rosshettel avatar rosshettel commented on August 15, 2024

Ah thanks for pointing that out. The directory already existed as I ran the container earlier without the env variable set, so that's why it didn't get created on startup. I'll close this then, thanks again!

from mariadb-docker.

thaJeztah avatar thaJeztah commented on August 15, 2024

You're welcome!

On 10 Jul 2016, at 03:56, Ross Hettel [email protected] wrote:

Ah thanks for pointing that out. The directory already existed as I ran the container earlier without the env variable set, so that's why it didn't get created on startup. I'll close this then, thanks again!


You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.

from mariadb-docker.

danielecr avatar danielecr commented on August 15, 2024

well no. It does not work.

In fact this is my composer:

services:
    mariadb:
        image: mariadb
        volumes:
            - ./dbdata:/docker-entrypoint-initdb.d
        environment:
            - MYSQL_ROOT_PASSWORD=rootte
            - MYSQL_DATABASE=sswsuitecrm
            - MYSQL_USER=sswsuitecrm
            - MYSQL_PASSWORD=suitepwd

and

MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| test               |
+--------------------+
4 rows in set (0.001 sec)

on first run

same when running with a void folder

from mariadb-docker.

LeDOC666 avatar LeDOC666 commented on August 15, 2024

Hello, I have the same problem, (And I think waited so much)
Here is my command:
docker run -d --name wp-mysql --network wp-network -v /data/wordpress/mysql:/var/lib/mysql -e MYSQL_USER=wordpress_user -e MYSQL_PASSWORD=wp_passmord -e MYSQL_DATABASE=wordpress -e MYSQL_RANDOM_ROOT_PASSWORD=1 mariadb

I deleted all /data/wordpress/mysql/* before, and still no database created !?

from mariadb-docker.

LeDOC666 avatar LeDOC666 commented on August 15, 2024

ok, I have to wait 30 min 👍

from mariadb-docker.

yosifkit avatar yosifkit commented on August 15, 2024

@LeDOC666, that sounds like #262.

from mariadb-docker.

gezichenshan avatar gezichenshan commented on August 15, 2024

Hi, my compose file is like:

version: "2"
services:
  mariadb_local:
    build:
      context: ./src
      dockerfile: mariadb-dockerfile
      args:
        MYSQL_DATABASE: dev
        MYSQL_ROOT_PASSWORD: dev
    container_name: mariadb_local
    restart: always
    ports:
      - 3306:3306
    volumes:
      - ./mariadb/data:/data
    environment:
      MYSQL_DATABASE: dev
      MYSQL_ROOT_PASSWORD: dev

and mariadb-dockerfile:

FROM mariadb

ADD dev.sql /docker-entrypoint-initdb.d

And I didn't see the dev DB created when I exec into mysql container.

P.S. I added build args because I see the doc says If your service specifies a build option, variables defined in environment are not automatically visible during the build. Use the args sub-option of build to define build-time environment variables. but still have no specified MYSQL_DATABASE created.

What am I missing?

from mariadb-docker.

danielecr avatar danielecr commented on August 15, 2024

https://docs.docker.com/engine/reference/builder/#add
yes, probably it was this missing:

If <dest> does not end with a trailing slash, it will be considered a regular file and the contents of <src> will be written at <dest>

so this line

ADD dev.sql /docker-entrypoint-initdb.d

should have been

ADD dev.sql /docker-entrypoint-initdb.d/

EDIT: the . in documentation is meant as the end of the sentence, nothing to do with . directory!

from mariadb-docker.

gezichenshan avatar gezichenshan commented on August 15, 2024

@danielecr Thanks!
You are right that I made a mistake forgot to add a slash in the end.

And another thing I think it is the build command in docker-compose file will only be executed at the first time when you do docker-compose up. The image will not be rebuilt the second time you type the same command. So if the first time the config is wrong in your dockerfile, you input docker-compose up then the wrong layer is added to the image. And the second time you will get same wrong result though you've changed the dockerfile.

So you should rebuild the image first and then up the container: type docker-compose build | docker-compose up to explicitly tell the docker to rebuild the image. Then the docker image layer will be changed and you will probably get desired result.

It is just a guess. I didn't verify it.

from mariadb-docker.

danielecr avatar danielecr commented on August 15, 2024

yes, that is also true. A shorter version is docker-compose --build up
(all on doc https://docs.docker.com/compose/reference/up/ as usual)

from mariadb-docker.

Shadow8472 avatar Shadow8472 commented on August 15, 2024

I see you're bind-mounting a directory (/srv/librenms/db), is this the first time you run a container using this directory? Was the directory empty before running the container? (the image will only initialize the database if the data directory is empty; see this line in the entrypoint script; https://github.com/docker-library/mariadb/blob/cc686f56875aa84d135bb89de6ca50385211bdab/10.1/docker-entrypoint.sh#L36)

Thank you for this key piece of advice. I've been pruning volumes instead of fully removing them while trying to get a Nextcloud pod assembly script together. I found leftover gunk in my volume from an earlier attempt. Thank you so much!

podman volume rm <volumeName>

from mariadb-docker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.