Skip to content

Instantly share code, notes, and snippets.

@traumverloren
Last active June 22, 2016 14:10
Show Gist options
  • Save traumverloren/09bb17924beb7af623767d5992c5bcce to your computer and use it in GitHub Desktop.
Save traumverloren/09bb17924beb7af623767d5992c5bcce to your computer and use it in GitHub Desktop.
Getting up and running with Docker

1. Make sure you have Docker toolbox installed:

https://docs.docker.com/mac/step_one/

2. Open Docker Quickstart Terminal in the launchpad!

3. Build the container:

Should only have to do this whenever starting up the VM or dockerfile has changed.

4. Probably will have to set the docker port and host port to be the same so can boot up and access it locally:

  • Open VirtualBox
  • Open Settings
  • Open Network
  • Open Port Forwarding
  • Click Add icon
  • name: rails (or whatever), host port: 3000, guest port: 3000
  • Open localhost:3000 in browser, should see the app working now!

5. If not working, try:

  • $ docker-machine restart default
  • $ eval $(docker-machine env default)

6. Issues with default virtual machine?

  • Open VirtualBox
  • Turn off the "default" machine
  • Run Docker Quickstart and it starts up the VM and connects fine!

7. After all this is setup, this is all that's needed to start this project:

  • Launch Docker Quickstart
  • $ eval $(docker-machine env default)
  • docker-compose up

8. Other tips:

  • To run rails console: $ docker-compose run web rails console
  • To see all the containers that are currently running: $ docker ps
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment