-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Unable to source initdb.d shell script #862
Comments
Also having this issue on OS X, both with and without the exec bit set. Oddly did not have this issue on the same codebase yesterday on a WSL2 (Windows) machine. |
$ ls -ln
total 8
drwxrwsr-x 2 1000 1000 4096 Dec 5 2019 data
-rwxrwxr-x 1 1000 1000 1458 Dec 5 2019 init-only-entry.sh
-rw-r--r-- 1 1000 1000 0 Jun 3 09:57 sourced.sh
$ [ -x ./init-only-entry.sh ] && echo yes || echo no
yes
$ [ -x ./sourced.sh ] && echo yes || echo no
no The workaround to just source the entrypoint is fine. You could alternatively drop the |
It doesn't seem to be macOS related issue. Something was broken in 8.0.28 $ docker run --rm -v '/home/circleci/workspace/infrastructure/migrations:/docker-entrypoint-initdb.d' --entrypoint ls mysql:8.0.28 -lah
total 76K
drwxr-xr-x 1 root root 4.0K Jul 7 10:09 .
drwxr-xr-x 1 root root 4.0K Jul 7 10:09 ..
-rwxr-xr-x 1 root root 0 Jul 7 10:09 .dockerenv
drwxr-xr-x 2 root root 4.0K Apr 18 00:00 bin
drwxr-xr-x 2 root root 4.0K Mar 19 13:44 boot
drwxr-xr-x 5 root root 340 Jul 7 10:09 dev
drwxr-xr-x 2 root root 4.0K Jul 7 09:03 docker-entrypoint-initdb.d
lrwxrwxrwx 1 root root 34 Apr 20 10:05 entrypoint.sh -> usr/local/bin/docker-entrypoint.sh
drwxr-xr-x 1 root root 4.0K Jul 7 10:09 etc
drwxr-xr-x 2 root root 4.0K Mar 19 13:44 home
drwxr-xr-x 1 root root 4.0K Apr 20 10:04 lib
drwxr-xr-x 2 root root 4.0K Apr 18 00:00 lib64
drwxr-xr-x 2 root root 4.0K Apr 18 00:00 media
drwxr-xr-x 2 root root 4.0K Apr 18 00:00 mnt
drwxr-xr-x 2 root root 4.0K Apr 18 00:00 opt
dr-xr-xr-x 136 root root 0 Jul 7 10:09 proc
drwx------ 1 root root 4.0K Apr 20 10:04 root
drwxr-xr-x 1 root root 4.0K Apr 20 10:05 run
drwxr-xr-x 2 root root 4.0K Apr 18 00:00 sbin
drwxr-xr-x 2 root root 4.0K Apr 18 00:00 srv
dr-xr-xr-x 13 root root 0 Jul 7 10:06 sys
drwxrwxrwt 1 root root 4.0K Apr 20 10:05 tmp
drwxr-xr-x 1 root root 4.0K Apr 18 00:00 usr
drwxr-xr-x 1 root root 4.0K Apr 18 00:00 var 8.0.29 $ docker run --rm -v '/home/circleci/workspace/infrastructure/migrations:/docker-entrypoint-initdb.d' --entrypoint ls mysql:8.0.29 -lah
ls: cannot access 'sys': Operation not permitted
ls: cannot access 'usr': Operation not permitted
ls: cannot access 'run': Operation not permitted
ls: cannot access 'etc': Operation not permitted
ls: cannot access 'sbin': Operation not permitted
ls: cannot access '.': Operation not permitted
ls: cannot access 'root': Operation not permitted
ls: cannot access 'lib': Operation not permitted
ls: cannot access '..': Operation not permitted
ls: cannot access 'home': Operation not permitted
ls: cannot access 'var': Operation not permitted
ls: cannot access 'bin': Operation not permitted
ls: cannot access 'boot': Operation not permitted
ls: cannot access 'mnt': Operation not permitted
ls: cannot access 'lib64': Operation not permitted
ls: cannot access 'dev': Operation not permitted
ls: cannot access 'proc': Operation not permitted
ls: cannot access 'opt': Operation not permitted
ls: cannot access 'tmp': Operation not permitted
ls: cannot access 'media': Operation not permitted
ls: cannot access 'srv': Operation not permitted
ls: cannot access '.dockerenv': Operation not permitted
ls: cannot access 'docker-entrypoint-initdb.d': Operation not permitted
total 0
d????????? ? ? ? ? ? .
d????????? ? ? ? ? ? ..
-????????? ? ? ? ? ? .dockerenv
l????????? ? ? ? ? ? bin
d????????? ? ? ? ? ? boot
d????????? ? ? ? ? ? dev
d????????? ? ? ? ? ? docker-entrypoint-initdb.d
d????????? ? ? ? ? ? etc
d????????? ? ? ? ? ? home
l????????? ? ? ? ? ? lib
l????????? ? ? ? ? ? lib64
d????????? ? ? ? ? ? media
d????????? ? ? ? ? ? mnt
d????????? ? ? ? ? ? opt
d????????? ? ? ? ? ? proc
d????????? ? ? ? ? ? root
d????????? ? ? ? ? ? run
l????????? ? ? ? ? ? sbin
d????????? ? ? ? ? ? srv
d????????? ? ? ? ? ? sys
d????????? ? ? ? ? ? tmp
d????????? ? ? ? ? ? usr
d????????? ? ? ? ? ? var This happens on the same machine (same kernel, same Docker, same everything). The only difference is MySQL Docker Image version. |
Ah, that looks like a seccomp failure -- if you run it with |
Got exactly same problem as issue starter. This is definetely something with Macos setup. I made script that worked perfectly in my linux machine, and it fails in Macos. |
The problem above forces me to make even more stupid solution because of limitations in docker-entrypoint.sh that I mentioned in this issue #357 (comment)
block could solve a lot of porblems. |
docker-compose.yml
:init/init.sh
(file mode 644):Spin up the container with
docker-compose up
, and it stops with error as below:To check the file permission of the init.sh in a separate container:
Apparently the
-x
test doesn't work as expected, so the init.sh is being run instead of sourced atmysql/8.0/docker-entrypoint.sh
Lines 67 to 73 in 275e982
I didn't encounter this error with Docker 20.10.14 on a Ubuntu 20.04.4.
At the moment, I have to workaround by making the init.sh executable instead, which involes:
chmod +x init/init.sh
docker_process_sql
in my actual script:The text was updated successfully, but these errors were encountered: