Skip to content
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

Docker container image for mysql 8.x in Dockerhub fails to be re-started #16

Open
aosadchyy opened this issue May 28, 2021 · 0 comments

Comments

@aosadchyy
Copy link

The Docker container image for mysql 8.x in Dockerhub (8.0.13) can be pulled and started on a IBM Z/IBM LinuxONE machine
https://hub.docker.com/r/ibmcom/mysql-s390x

However, after docker restart, the container fails to start again.

The reason it always tries to initialize the database newly, even if it was already initialed the very first start.
"Cmd": [
"/bin/sh",
"-c",
"/usr/local/mysql/bin/mysqld --initialize --user=mysql && /usr/local/mysql/bin/mysqld_safe --user=mysql"]

After a restart, it fails to start with the following error
2021-05-19T10:59:44.931154Z 0 [System] [MY-013169] [Server] /usr/local/mysql/bin/mysqld (mysqld 8.0.15) initializing of server in progress as process 8
2021-05-19T10:59:44.932740Z 0 [ERROR] [MY-010457] [Server] --initialize specified but the data directory has files in it. Aborting.
2021-05-19T10:59:44.932749Z 0 [ERROR] [MY-013236] [Server] Newly created data directory /usr/local/mysql/data/ is unusable. You can safely remove it.
2021-05-19T10:59:44.932791Z 0 [ERROR] [MY-010119] [Server] Aborting

Suggested workaround:

Substitute command inside of the container, e.g.

docker run --name=mysql1 -p 3306:3306 --restart on-failure --user=mysql -v /root/data:/usr/local/mysql/data -d ibmcom/mysql-s390x:8.0.13 /bin/sh -c "/usr/local/mysql/bin/mysqld --initialize --user=mysql; /usr/local/mysql/bin/mysqld_safe"

Suggested fix:
Change CMD to "/usr/local/mysql/bin/mysqld --initialize --user=mysql; /usr/local/mysql/bin/mysqld_safe" with a semicolon instead of &&. This won't eliminate the error on 2nd start, but will also let the container continue to run successfully.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant