Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,19 @@ As you interact you should logging in the second and third windows.
1. Allow it to register itself
1. Kill the first account-server and see the web-server switch to using the new account-server - no loss of service.

## Docker Compose

Compose is a tool for defining and running multi-container Docker applications. With Compose, you use a Compose file to configure your application’s services. Then, using a single command, you create and start all the services from your configuration.

This compose configuration assumes the docker daemon is running on a single VM.

Assuming that you have [Docker Toolbox installed](https://www.docker.com/docker-toolbox) and running.

1. Change to the directory where you have cloned the demo.
1. Build the application using `mvn clean package`
1. In the same window run: `docker-compose up`

Currently there is no way in Compose to defer starting a container until after another container is up and running, subsequently in the container logs you will see Connection exceptions until all the containers are up and running.

When all containers are up you can access the Eureka Dashboard at http://DOCKER_HOST_IP:1111, the DOCKER_HOST_IP can be determined from the $DOCKER_HOST environment variable, an env variable that tells your Docker client on your host machine the URI for the Docker daemon running on the VM.

38 changes: 38 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
registration:
image: java:8
ports:
- 1111:1111
volumes:
- ./target:/app
command: java -Djava.security.egd=file:/dev/./urandom -jar /app/microservice-demo-0.0.1-SNAPSHOT.jar registration
accountsA:
image: java:8
volumes:
- ./target:/app
command: java -Djava.security.egd=file:/dev/./urandom -jar /app/microservice-demo-0.0.1-SNAPSHOT.jar accounts
links:
- registration
environment:
EUREKA_CLIENT_SERVICEURL_DEFAULTZONE: http://registration:1111/eureka/
accountsB:
image: java:8
volumes:
- ./target:/app
command: java -Djava.security.egd=file:/dev/./urandom -jar /app/microservice-demo-0.0.1-SNAPSHOT.jar accounts
links:
- registration
environment:
EUREKA_CLIENT_SERVICEURL_DEFAULTZONE: http://registration:1111/eureka/
web:
image: java:8
ports:
- 3333:3333
volumes:
- ./target:/app
command: java -Djava.security.egd=file:/dev/./urandom -jar /app/microservice-demo-0.0.1-SNAPSHOT.jar web
links:
- registration
- accountsA
- accountsB
environment:
EUREKA_CLIENT_SERVICEURL_DEFAULTZONE: http://registration:1111/eureka/