Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/darrenhaken/docker-examples
Docker examples demonstrating it's capabilities with Java applications
https://github.com/darrenhaken/docker-examples
Last synced: about 2 months ago
JSON representation
Docker examples demonstrating it's capabilities with Java applications
- Host: GitHub
- URL: https://github.com/darrenhaken/docker-examples
- Owner: darrenhaken
- Created: 2017-04-24T16:37:53.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-05-31T14:17:37.000Z (over 7 years ago)
- Last Synced: 2024-10-15T11:39:03.278Z (3 months ago)
- Language: Java
- Size: 24.1 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# docker-examples
Docker examples demonstrating it's capabilities running multiple applications at the same time## Docker guide
#### 1. Local run
Run Spring Boot locally (via IDE)
#### Show version 1.0 running in Docker
``` bash
docker-compose up
docker ps
```[Browse to Java app](http://localhost:8080 "Java App")
[Browse to Python app](http://localhost:5000 "Python App")
#### Docker image versioning
Increase the tag to 1.1 in Docker compose
``` bash
docker-compose build
docker-compose up
```
[Browse to localhost:8080](http://localhost:8080 "Spring Boot Homepage")[Browse to localhost:5000](http://localhost:5000 "Flask Homepage")
### Orchestration
#### Deploy to Swarm
Setup Docker Swarm on master
``` bash
#Get IP of manager
docker-machine ip manager1# SSH on manager
docker-machine ssh manager1#Initialise swarm with node as leader
#Will skip this step as I did it ahead of time
docker swarm init --advertise-addr#Show nodes connected to swarm
docker node ls
```Join Swarm on the workers
``` bash
docker-machine ssh worker1
docker swarm join \
--token SWMTKN-1-5ivfibz1i7mok4mh919aleuh9ksbskok8boj3v4tt4ifzd7g72-bxrfrwg5w842f2jj6d6pyzffu \
192.168.99.100:2377
```Deploy stack to swarm
#### Change Docker Daemon
eval $(docker-machine env manager1)#### Build cluster on Docker on manager1
docker-compose build#### Set the docker cli to use manager1
docker-machine env manager1#### Optional but might be needed
docker-machine regenerate-certs manager1#### Deploy cluster to manager1
docker stack deploy --compose-file docker-compose.yml helloworld#### On the Docker manager
docker service ls#### Lets scale Web up
docker service scale helloworld_web=8#### Applying rolling updates
docker service update --image : web#### Let's kill the containers
docker service rm helloworld_redis
docker stop $(docker ps -a -q)#### Removing services
docker service rm helloworld_flask helloworld_web helloworld_redis#### Revert docker daemon back to Docker for Mac
eval $(docker-machine env -u)