Giter Site home page Giter Site logo

Comments (18)

blafasel42 avatar blafasel42 commented on July 28, 2024 9

any news on this? i have the same issue

from mariadb-docker.

florianajir avatar florianajir commented on July 28, 2024 5

If your container has been initialized before you put sql dump in share volume of your docker-compose.yml you need to remove the volume and recreate the container to restart initialisation process:

docker volume ls
docker volume rm your_volume_name

from mariadb-docker.

waynetheisinger avatar waynetheisinger commented on July 28, 2024 4

+1 I've the same issue

from mariadb-docker.

MartinMuzatko avatar MartinMuzatko commented on July 28, 2024 3

I found the problem: As @florianajir correctly suggested: The files are only then read, when the container is created anew!

This solved the problem for me.

from mariadb-docker.

yosifkit avatar yosifkit commented on July 28, 2024 1

It has to be permissions on the files in the initdb directory. The only difference for this part between the mariadb and postgres entrypoint scripts is that postgres is still running as the root user when it runs the scripts while mariadb/mysql is running as the mysql user in the container.

from mariadb-docker.

waynetheisinger avatar waynetheisinger commented on July 28, 2024 1

though you have to 777 it because it's owned by root, so @yosifkit might be right when he says its probably permissions...

from mariadb-docker.

yosifkit avatar yosifkit commented on July 28, 2024 1

@luandro, what are the permissions of that file and folder from inside the sql container? The scripts/sql files in /docker-entrypoint-initdb.d/ are run by the mysql user of the container, so they need to be readable by that user.

Or possibly related to docker-library/postgres#203 (comment).

from mariadb-docker.

ratshidaho avatar ratshidaho commented on July 28, 2024 1

Hi there.

I had the same issue, and all I did was to give the full path to my local folder that I am mounting and it worked.

from mariadb-docker.

MartinMuzatko avatar MartinMuzatko commented on July 28, 2024 1

@jm-ds Files are converted to folders if the linux system that docker brings with it, is not able to locate the files correctly.

from mariadb-docker.

yosifkit avatar yosifkit commented on July 28, 2024

So, init-db is a directory with a file ending in .sql? Is the directory and file readable by user 999 (which is what the sql process runs as)?

from mariadb-docker.

sebglon avatar sebglon commented on July 28, 2024

Yes init-db is a directory with file endind in .sql ans .sh. this directory is readable by docker an mounter on container with root '770'.

For information this don't work on Mysql but work with postgres images

from mariadb-docker.

sebglon avatar sebglon commented on July 28, 2024

After than container is started and file is ignored, if i make this command, file is imported:
mysql -u $MYSQL_USER -p$MYSQL_PASSWORD $MYSQL_DATABASE < /docker-entrypoint-initdb.d/file.sql

The .sql file is read and imported on my database.

from mariadb-docker.

waynetheisinger avatar waynetheisinger commented on July 28, 2024

if you create your own dockerfile that use extend FROM this mariadb base image and use an ADD to copy the file into the images container it works... but it doesn't work when you load it as a volume

from mariadb-docker.

loranger avatar loranger commented on July 28, 2024

Having the same issue.
I'm not even able to achieve the solution provided by @waynetheisinger.
The only solution I found is to run a bash session within the image and inject my /docker-entrypoint-initdb.d/dump.sql manually.
Is there another way ?

from mariadb-docker.

yosifkit avatar yosifkit commented on July 28, 2024

Closing old issue. (still think it is/was permissions)

from mariadb-docker.

luandro avatar luandro commented on July 28, 2024

Having the same issue... Should be a better explanation on how to use. Here's my docker-compose.yml:

version: '2'
services:
  wordpress:
    image: wordpress:latest
    restart: always
    volumes:
      - ./config/php.conf.uploads.ini:/usr/local/etc/php/conf.d/uploads.ini
      - ./wp-app:/var/www/html # Full wordpress project
    environment:
      WORDPRESS_DB_PASSWORD: '${DB_PASSWORD}'
  mysql:
    image: mariadb:latest
    restart: always
    volumes:
      - ./wp-data:/docker-entrypoint-initdb.d
    environment:
      MYSQL_ROOT_PASSWORD: '${DB_PASSWORD}'

Inside ./wp-data/ there's a .sql dump file.

from mariadb-docker.

jm-ds avatar jm-ds commented on July 28, 2024

I'm having this exact issue on win 7 with toolbox but not on the unbuntu 17 where the image is built. What's odd in my case is that the files appear to be converted to directories when moved from Ubuntu to windows. I just saved the image and reloaded on windows and then ran docker-compose up -d.

When I bash into the image and ls -l inside docker-entrypoint-initdb.d I get the following:

drwxrwxrwx 2 root root 40 Dec 5 23:04 OnPremise.sql
drwxrwxrwx 2 root root 40 Dec 5 23:04 mysql-setup.sql

======== UPDATE ========
I was able to get my instance to work by using COPY in a Dockerfile instead of using volume from within docker-compose.yml. There's definitely something not right now the volume mounts seeing as it converted my files to directories when moved from Ubuntu to windows. I am, however, on Win 7 using Docker toolbox.

from mariadb-docker.

twogood avatar twogood commented on July 28, 2024

I solved this by using an absolute path to the docker-entrypoint-initdb.d directory

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.