You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
which is an "Out-of-the-box LAMP image (PHP+MySQL) for Docker".
8
12
9
-
osx-docker-mysql is instead an:
10
-
11
-
Out-of-the-box MySQL Docker image that *just works* on Mac OS X.
12
-
13
-
However, it has also been tested for Docker running under GNU/Linux (Ubuntu 14.10).
14
-
15
13
Some info about osx-docker-mysql:
16
14
17
15
- It is based on [phusion/baseimage:latest](http://phusion.github.io/baseimage-docker/)
18
16
instead of ubuntu:trusty.
17
+
- It works flawlessy regardless of using boot2docker standalone or with Vagrant. You will need to set three enrironment varibles, though.
19
18
- It fixes OS X related [write permission errors for MySQL](https://github.com/boot2docker/boot2docker/issues/581)
20
19
- It lets you mount OS X folders *with write support* as volumes for
21
20
- The database
22
21
- If `CREATE_MYSQL_BASIC_USER_AND_DB="true"`, it creates a default database and user with permissions to that database
23
22
- It is documented for less advanced users (like me)
24
23
25
-
26
24
##Usage
27
25
26
+
If using Vagrant, please see the extra steps in the next subsection.
27
+
28
28
If you need to create a custom image `youruser/mysql`,
29
29
execute the following command from the `osx-docker-mysql` source folder:
30
30
31
-
docker build -t youruser/mysql .
31
+
docker build -t youruser/mysql .
32
32
33
33
If you wish, you can push your new image to the registry:
34
34
35
-
docker push youruser/mysql
35
+
docker push youruser/mysql
36
36
37
37
Otherwise, you are free to use dgraziotin/mysql as it is provided. Remember first
38
38
to pull it from the Docker Hub:
39
39
40
40
docker pull dgraziotin/mysql
41
41
42
+
###Vagrant
43
+
44
+
If, for any reason, you would rather use Vagrant (I suggest using [AntonioMeireles/boot2docker-vagrant-box](https://github.com/AntonioMeireles/boot2docker-vagrant-box)), you need to add the following three variables when running your box:
45
+
46
+
-`VAGRANT_OSX_MODE="true"` for enabling Vagrant-compatibility
47
+
-`DOCKER_USER_ID=$(id -u)` for letting Vagrant use your host user ID for mounted folders
48
+
-`DOCKER_USER_GID=$(id -g)` for letting Vagrant use your host user GID for mounted folders
49
+
50
+
See the Environment variables section for more options.
42
51
43
-
###Running your LAMP docker image
52
+
###Running your MySQL docker image
44
53
45
54
If you start the image without supplying your code, e.g.,
46
55
47
-
docker run -t -i -p 3306:3306 --name db dgraziotin/mysql
56
+
docker run -t -i -p 3306:3306 --name db dgraziotin/mysql
48
57
49
58
At [boot2docker ip] you should be able to connect to MySQL.
50
59
@@ -53,7 +62,7 @@ At [boot2docker ip] you should be able to connect to MySQL.
53
62
If you wish to mount a MySQL folder locally, so that MySQL files are saved on your
54
63
OS X machine, run the following instead:
55
64
56
-
docker run -i -t -p "3306:3306" -v ${PWD}/mysql:/mysql --name db dgraziotin/mysql
65
+
docker run -i -t -p "3306:3306" -v ${PWD}/mysql:/mysql --name db dgraziotin/mysql
57
66
58
67
The MySQL database will thus become persistent at each subsequent run of your image.
59
68
@@ -83,18 +92,18 @@ with all root privileges will be created in MySQL with a random password.
83
92
84
93
To get the password, check the logs of the container by running:
In this case, `47nnf4FweaKu` is the password allocated to the `admin` user.
100
109
@@ -111,17 +120,18 @@ the the `MYSQL_USER_*` variables, explained below.
111
120
112
121
##Environment variables
113
122
114
-
- MYSQL_ADMIN_PASS="mypass" will use your given MySQL password for the `admin`
123
+
-`MYSQL_ADMIN_PASS="mypass"` will use your given MySQL password for the `admin`
115
124
user instead of the random one.
116
-
- CREATE_MYSQL_BASIC_USER_AND_DB="true" will create the user `user` with db `db` and password `password`. Not needed if using one of the following three MYSQL_USER_* variables
117
-
- MYSQL_USER_NAME="daniel" will use your given MySQL username instead of `user`
118
-
- MYSQL_USER_DB="supercooldb" will use your given database name instead of `db`
119
-
- MYSQL_USER_PASS="supersecretpassword" will use your given password instead of `password`
120
-
- PHP_UPLOAD_MAX_FILESIZE="10M" will change PHP upload_max_filesize config value
121
-
- PHP_POST_MAX_SIZE="10M" will change PHP post_max_size config value
125
+
-`CREATE_MYSQL_BASIC_USER_AND_DB="true"` will create the user `user` with db `db` and password `password`. Not needed if using one of the following three `MYSQL_USER_*` variables
126
+
-`MYSQL_USER_NAME="daniel"` will use your given MySQL username instead of `user`
127
+
-`MYSQL_USER_DB="supercooldb"` will use your given database name instead of `db`
128
+
-`MYSQL_USER_PASS="supersecretpassword"` will use your given password instead of `password`
129
+
-`VAGRANT_OSX_MODE="true"` for enabling Vagrant-compatibility
130
+
-`DOCKER_USER_ID=$(id -u)` for letting Vagrant use your host user ID for mounted folders
131
+
-`DOCKER_USER_GID=$(id -g)` for letting Vagrant use your host user GID for mounted folders
122
132
123
133
Set these variables using the `-e` flag when invoking the `docker` client.
0 commit comments