Closed zxyqq closed 7 years ago
Hello there.
This line is where the issue occurred. This line is supposed to insure that the Gerrit has the correct permission to write to the volume. Since there is no gosu
ahead of chown
, chown
is supposed to be executed as root. So here's my question. Could you tell me whether sudo chown -R 1000 /home/mysql/docker_volumes/gerrit
can be executed successfully on your host?
Here is an advise. I'd mount docker volumes created by docker volume create
command instead of mounting local directories, especially those directories under the ~
which may cause permission issues.
thanks thinkernel!
(1) “docker run …… ” command is execute by root
(2) Both the owner and group of "/home/mysql/docker_volumes/gerrit" are 1000 the uid and gid of user "mysql" is 1000, that's why I choose /home/mysql as the local directory
[root@localhost ~]# ls -ln /home/mysql/docker_volumes
总用量 0
drwxrwxr-x. 2 1000 1000 6 11月 16 01:19 gerrit
[root@localhost ~]#
(3) I use the docker volume create
to create a volume and use the created volume to mount, it failed
[root@localhost ~]# docker volume create --name gerrit
gerrit
[root@localhost ~]# docker run \
-it \
--name gerrit \
-p 8080:8080 \
-p 29418:29418 \
-v gerrit:/var/gerrit/review_site \
-e AUTH_TYPE=DEVELOPMENT_BECOME_ANY_ACCOUNT \
--rm docker.io/openfrontier/gerrit
/gerrit-entrypoint.sh: ignoring /docker-entrypoint-init.d/*
Upgrading gerrit...
Exception in thread "main" com.google.gwtorm.server.OrmException: Cannot downgrade database schema from version 129 to 115.
at com.google.gerrit.server.schema.SchemaVersion.check(SchemaVersion.java:68)
at com.google.gerrit.server.schema.SchemaUpdater.update(SchemaUpdater.java:107)
at com.google.gerrit.pgm.init.BaseInit$SiteRun.upgradeSchema(BaseInit.java:341)
at com.google.gerrit.pgm.init.BaseInit.run(BaseInit.java:127)
at com.google.gerrit.pgm.util.AbstractProgram.main(AbstractProgram.java:64)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.google.gerrit.launcher.GerritLauncher.invokeProgram(GerritLauncher.java:159)
at com.google.gerrit.launcher.GerritLauncher.mainImpl(GerritLauncher.java:100)
at com.google.gerrit.launcher.GerritLauncher.main(GerritLauncher.java:56)
at Main.main(Main.java:25)
(4) If not use the -v
option, it works, but why?
[root@localhost ~]# docker run \
> -it \
> --name gerrit \
> -p 8080:8080 \
> -p 29418:29418 \
> -e AUTH_TYPE=DEVELOPMENT_BECOME_ANY_ACCOUNT \
> --rm docker.io/openfrontier/gerrit
(5) all the above problem not exist on the PC in company. the only difference is : the PC in company is a true OS run PC the PC now I use at home is the same OS: centos7 run in virtualbox on Win10.
after upgrade the virutalbox version to VirtualBox-5.1.10-112026-Win.exe, this problem solved
[root@localhost /]#docker run -it --name gerrit -p 8080:8080 -p 29418:29418 -v /home/mysql/docker_volumes/gerrit:/var/gerrit/review_site -e AUTH_TYPE=DEVELOPMENT_BECOME_ANY_ACCOUNT --rm docker.io/openfrontier/gerrit chown: /var/gerrit/review_site: Permission denied
[root@localhost /]# id mysql uid=1000(mysql) gid=1000(mysql) 组=1000(mysql)
anybody can help me? This problem confuse me long