-
Notifications
You must be signed in to change notification settings - Fork 444
Fail to mount and initialise DB with /docker-entrypoint-initdb.d #62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
So, |
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 |
After than container is started and file is ignored, if i make this command, file is imported: The .sql file is read and imported on my database. |
any news on this? i have the same issue |
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 |
+1 I've the same issue |
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 |
though you have to 777 it because it's owned by root, so @yosifkit might be right when he says its probably permissions... |
Having the same issue. |
Closing old issue. (still think it is/was permissions) |
Having the same issue... Should be a better explanation on how to use. Here's my
Inside |
@luandro, what are the permissions of that file and folder from inside the sql container? The scripts/sql files in Or possibly related to docker-library/postgres#203 (comment). |
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. |
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 ======== UPDATE ======== |
I solved this by using an absolute path to the docker-entrypoint-initdb.d directory |
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 |
@jm-ds Files are converted to folders if the linux system that docker brings with it, is not able to locate the files correctly. |
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. |
if i set sql file on $(pwd)/init-db, and run this command
docker run -v $(pwd)/init-db:/docker-entrypoint-initdb.d -e MYSQL_ROOT_PASSWORD=tutu
-e MYSQL_DATABASE=tutu -e MYSQL_PASSWORD=tutu mariadb
Mariadb ignore file /docker-entrypoint-initdb.d
"/usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint-initdb.d/* "'
The text was updated successfully, but these errors were encountered: