GithubHelp home page GithubHelp logo

docker-compose-demo's Introduction

Docker Compose Demo

This is an example of how Docker can be used to compose a complete environment. The containers used in this demo are:

  • dockerui: Container that exposes DOcker UI dashboard.
  • apache: Apache HTTPD used as a front of JBoss.
  • jboss: App "task-viewer" running on Jboss 5.1.0GA with Java 6. The image is based on Centos 6.7. The application is downloaded from "https://github.com/yannart/task-viewer.git" and compiled with Maven when the Docker image is built.
  • webapp: App "task-manager-app" running as an executable jar with an embedded Tomcat server on Java 8. The image is based on last version available of Centos 6.7. The application is downloaded from "https://github.com/yannart/task-manager-app.git" and compiled with Maven when the Docker image is built.
  • mysql: MySQL server based on official Docker image, loads initial SQL script at first execution to prepare the schema required by the applications.
  • elasticsearch and elasticsearchbis: Elasticsearch containers using the last Elasticsearch official image. The two containers are used to form an Elasticsearch cluster.
  • activemq: Last version available of webcenter/activemq Docker image.

Installation

Windows

Install Docker Toolbox

Download and install Docker Toolbox (require >= 1.9.1c): https://www.docker.com/docker-toolbox

Add these lines in "C:\Windows\System32\drivers\etc\hosts":

DOCKER_HOST_IP mysql
DOCKER_HOST_IP docker.host

Where DOCKER_HOST_IP is the IP of Docker VM.

Create / start the Docker host VM
  • Open the bash console included with Git and move to the project location.

  • If you want to specify a specific location to store the Docker VM, use the environment variable MACHINE_STORAGE_PATH:

    export MACHINE_STORAGE_PATH=/path/to/vm
    
  • Create the docker host virtual machine:

    docker-machine create ggdocker --driver virtualbox --virtualbox-cpu-count "4" --virtualbox-memory "4096" --virtualbox-no-share
    docker-machine stop ggdocker
    

Where:

  • --virtualbox-cpu-count number of CPUs for the machine (-1 to use the number of CPUs available)
  • --virtualbox-memory size of memory for host in MB
  • --virtualbox-no-share Disable the mount of your home directory

Full options:

docker-machine create --driver virtualbox --help
  • In VirtualBox, modify the ggdocker VM to:

    • Setup a shared folder "container_data" checking the option "auto-mount". The selected folder in Windows will contain the data and logs of the containers.
  • Start the VM docker-machine start ggdocker

  • Execute the commands to share the folder:

    docker-machine.exe ssh ggdocker 'sudo mkdir --parents //container_data'
    docker-machine.exe ssh ggdocker 'sudo mount -t vboxsf container_data //container_data'
    
  • Update the Docker environment

    eval "$(docker-machine env ggdocker)"
    export DOCKER_HOST_IP=`docker-machine ip ggdocker`
    

    It can be required, if asked, to regenerate the certificates used to communicate with docker daemon:

    docker-machine regenerate-certs ggdocker
    

Linux

Install Docker & Docker compose

Follow the installation instructions in https://docs.docker.com/engine/installation/ and https://docs.docker.com/compose/install/.

Add these lines in "/etc/hosts":

DOCKER_HOST_IP mysql
DOCKER_HOST_IP docker.host

Where DOCKER_HOST_IP is the IP of Docker VM.

Run the containers

docker-compose up -d

To force to rebuild a project:

docker-compose build --no-cache apache

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.