Giter Club home page Giter Club logo

docker-development-helper's Introduction

Docker compose with shared mounts

Because it makes life happy.

Prerequisites

You'll need the following flux capacitors installed:

Starting it up

  1. Validate that vagrant, docker-machine, and docker-compose run the right commands from your command line.
  2. Fork and clone this repo; navigate to it in your shell.
  3. Customize docker-compose.yml as desired. The default setup is a super-simple Wordpress theme editing setup.
  4. Run vagrant plugin install vagrant vagrant-host-shell
  5. Run vagrant up
  6. Load up the Docker environment and start your services: eval $(docker-machine env vagrant); docker-compose up
  7. Once the machines are up, just go to 172.20.254.2 in your web browser.

You can use the same Vagrant environment for multiple docker compositions; just set up your environmental variables with eval $(docker-machine env vagrant). The only limitation here is that you'll want to make sure your shared ports don't conflict.

Tearing it down

  1. Remove the docker-machine configuration: docker-machine rm vagrant
  2. Destroy the vagrant box: vagrant destroy -f

Under the hood

Terminology

The outmost environment (Windows, OS X, etc) is what I call the VM host. On it, we run a vagrant guest. The vagrant guest runs Docker so it's also the docker host. The docker host runs a bunch of containers with are... containers.

Notify events in the guest/docker

Things like grunt watch/etc will still need to be run on the VM host. This is because filesystem event notifications aren't passed through the Virtualbox or VMware sharing mechanisms.

Changing shared paths

If you want to change the paths shared with the guest, it's a two-step process:

  1. Update your Vagrantfile to share the desired VM host paths with the docker host.
  2. Update docker-compose.yml to mount the desired paths on the docker host to the docker container.

Changing IPs

Make sure you change IPs in both places in the Vagrantfile if you need to do so.

Multiple providers caveat

There's a cheap hack to find the SSH key during provisioning. If you have used multiple vagrant providers, completely remove the .vagrant directory from the cloned repository before bringing a new machine up.

docker-development-helper's People

Contributors

combatpoodle avatar j-baker avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

docker-development-helper's Issues

No license

Hey,
I found this Vagrantfile very useful today, and would like to modify it slightly and include it in my project.
Is there any chance you could open source license this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.