Skip to content

Instantly share code, notes, and snippets.

@VVCepheiA
Last active August 29, 2015 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save VVCepheiA/d25aa395b34ffb8404c6 to your computer and use it in GitHub Desktop.
Save VVCepheiA/d25aa395b34ffb8404c6 to your computer and use it in GitHub Desktop.
Rek Docker on Mac

Docker Setup on Mac

Note: The following steps are meant to create an environment for deploying app with tomcat and mysql with a war file. Assuming you are using mac. For the Linux server version, please go here.

  1. Download Docker here. This should give you everything you need to run Docker on Mac. Note: You don't need to install VM or boot2docker if you are on Linux.

If you don't like the convenient way, you can do it manually. Install Docker, VM (for running boot2docker) and boot2docker (for running Docker on Mac)

$ brew cask install virtualbox
$ brew install docker
$ brew install boot2docker
$ boot2docker init
$ boot2docker up
  1. Go here and follow the step there to get the mysql image/Dockerfile. It's a good idea to create a new empaty folder for the files from the repo. Replace the "XXXXXXXX" with desired username/password.
$ docker run -d --name db -e MYSQL_USER="XXXXXXXX" -e MYSQL_PASSWORD="XXXXXXXX" -e MYSQL_ROOT_PASSWORD="XXXXXXXX"  -e MYSQL_DATABASE="rekomendi" -p 3306:3306 mysql
  1. [Optional]To resolve the port forwarding problem, go here
  • If you are on Linux, you don't need it.
  • This step is optional. I personally don't use this method, I use the vm ip method (I will mention it later) to resolve this problem.
  • if you are lazy if you want to use it without reading just try
$ boot2docker ssh -L 8080:localhost:8080
  1. Go here and follow the step there to build the tomcat image. It's a good idea to create a new empaty folder for the files from the repo. Also, you should put the war files you want to deploy in this folder.
$ docker build -t tutum/tomcat .

Then link it with the mysql we created earlier.

$ docker run -d -p 8080:8080 --name web-sql --link rek-mysql:mysql tutum/tomcat
  1. If you didn't do the optional step 2, you should get the vm ip
$ boot2docker ip

and you should get something similar to 192.168.59.103 blah. Now /*hopefully*/ you are able to access ip:8080/rekomendi-cockpit, in my case 192.168.59.103:8080/rekomendi-cockpit Note: The port mapping is highly customizable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment