Difference between revisions of "Docker on Mac"
Jump to navigation
Jump to search
(→mysql) |
|||
(5 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | Unfortunately Docker usage on | + | Unfortunately Docker usage on Mac OSX is limited see: |
* https://docs.docker.com/docker-for-mac/networking | * https://docs.docker.com/docker-for-mac/networking | ||
This means the approach: | This means the approach: | ||
Line 15: | Line 15: | ||
http://localhost now works | http://localhost now works | ||
== mysql == | == mysql == | ||
− | + | see https://severalnines.com/blog/mysql-docker-containers-understanding-basics for the principal way that works on linux (but not on a Mac!) | |
+ | Same idea - this case we use a different port to have no conflict with a locally installed mysql | ||
<source lang='bash'> | <source lang='bash'> | ||
docker run --name mysql57 --detach --env=MYSQL_ROOT_PASSWORD=root -p 3307:3306 mysql/mysql-server:5.7.14 | docker run --name mysql57 --detach --env=MYSQL_ROOT_PASSWORD=root -p 3307:3306 mysql/mysql-server:5.7.14 | ||
mysql -uroot -proot -h 127.0.0.1 -P 3307 | mysql -uroot -proot -h 127.0.0.1 -P 3307 | ||
</source> | </source> | ||
− | Please | + | Please note we are using version 5.7.14 here! |
+ | == phpmyadmin == | ||
+ | * https://hub.docker.com/r/phpmyadmin/phpmyadmin/ | ||
+ | |||
+ | <source lang='bash'> | ||
+ | docker run --name phpmyadmin -d --link mysql57:db -p 8982:80 -h phpmyadmin phpmyadmin/phpmyadmin | ||
+ | </source> | ||
+ | = configure nginx = | ||
+ | * https://gist.github.com/soheilhy/8b94347ff8336d971ad0 |
Latest revision as of 15:24, 27 August 2017
Unfortunately Docker usage on Mac OSX is limited see:
This means the approach:
docker run -d --name webserver nginx
docker inspect webserver | grep 'IPAddress":'
"IPAddress": "172.17.0.2",
"IPAddress": "172.17.0.2",
and then trying to connect via http://172.17.0.2 on port 80 won't work The workaround is to publish the port locally:
docker run -d -p 80:80 --name webserver nginx
http://localhost now works
mysql
see https://severalnines.com/blog/mysql-docker-containers-understanding-basics for the principal way that works on linux (but not on a Mac!) Same idea - this case we use a different port to have no conflict with a locally installed mysql
docker run --name mysql57 --detach --env=MYSQL_ROOT_PASSWORD=root -p 3307:3306 mysql/mysql-server:5.7.14
mysql -uroot -proot -h 127.0.0.1 -P 3307
Please note we are using version 5.7.14 here!
phpmyadmin
docker run --name phpmyadmin -d --link mysql57:db -p 8982:80 -h phpmyadmin phpmyadmin/phpmyadmin