I'm trying to build a MySQL image locally. It looks like the docker branch of MySQL is using a lot of sophisticated and complex tools to get things to work by simply running docker run --name my-container-name -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mysql/mysql-server:8.0. That's really cool that it works that way, but I'm having trouble keeping track of containers and have taken up a system of creating a directory containing all my forks of Dockerfile repos with the addition of Makefiles for building, debugging, listing and instantiating new container instances. I'm having trouble applying this approach to the MySQL dockerfile repo located at (mysql/mysql-docker)[https://github.com/mysql/mysql-docker]. It looks unlike an other dockerfile repos that I've seen. A particular pattern must have been applied to it's creation, but I am unable to determine more information about this pattern. Btw, the link to https://hub.docker.com/r/mysql/mysql-labs/ in the README.md on this repo is broken, and issues are turned off on that repo, possibly to funnel all issues here, possibly because the readme for that repo is generated from some other repository I have not discovered yet.
That said, my current steps to generate the MySQL image locally have been to navigate to https://github.com/mysql/mysql-docker/tree/mysql-server/8.0 and copy and paste the two Dockerfile items in that folder into a new repository. Ultimately, I run the below sorts of commands with a build automation script that is tracked into the repo:
docker build -t john/mysql-docker .
docker run -it \
-e MYSQL_ROOT_PASSWORD=my-secret-pw \
john/mysql-docker bash
Something must be not quite right with the entrypoint.sh because in performing the above operations, I'm confronted with the following error message:
/entrypoint.sh: line 124: warning: here-document at line 66 delimited by end-of-file (wanted `EOSQL')
/entrypoint.sh: line 125: syntax error: unexpected end of file
make: *** [console] Error 2
I haven't been able to uncover a solution for locally building and running the MySQL Image beyond this point. Does anyone have any ideas?
Will try to note things in order:
Thanks @ltangvald, very helpful. The pattern I was referring to was the usage of separate folders for automated builds. It seems I need to dig into the docs at hub.docker.com a bit further. My build problem is still unresolved though, I hope I'm not doing anything obviously wrong.
I've pushed the exact Dockerfile repo I'm working with to https://github.com/thenotary/mysql-docker It was generated from copy/ pasting as described before.
$ docker build -t john/mysql-docker .
$ docker run -it --name=mysql_db_for_any_old_project john/mysql-docker /bin/bash
/entrypoint.sh: line 121: warning: here-document at line 63 delimited by end-of-file (wanted `EOSQL')
/entrypoint.sh: line 122: syntax error: unexpected end of file
$ docker -v
Docker version 1.12.1, build 23cf638
Are you getting different outputs? What steps are you taking to build the image locally?
@TheNotary It is failing because you used spaces instead of tabs to indent the entrypoint file. Specifically it will break the heredocs that are using <<-. <<- allows the heredoc to be indented with the rest of a block, but only suppresses leading tabs. See http://www.tldp.org/LDP/abs/html/here-docs.html for more info.
Thanks for all the help! Indeed the image builds and boots without error when the entrypoint contains the correct whitespaces :flushed: