Skip to content

Commit

Permalink
Added swarm on docker-machine example.
Browse files Browse the repository at this point in the history
  • Loading branch information
kevana committed Jan 24, 2016
1 parent a198382 commit 49d4c58
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 0 deletions.
3 changes: 3 additions & 0 deletions examples/swarm/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM debian

RUN apt-get update && apt-get install -y socat
11 changes: 11 additions & 0 deletions examples/swarm/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# DockerUI with Swarm

This example works with swarm clusters created with docker-machine.

## Usage

Make sure your client is pointed directly to the Docker daemon on the swarm-master's node (not through swarm).

```
docker-compose up -d
```
11 changes: 11 additions & 0 deletions examples/swarm/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
dockerui:
image: dockerui/dockerui
command: -e http://127.0.0.1:2375
net: "host"

socat:
build: .
net: "host"
command: socat -d -d TCP-L:2375,fork,bind=localhost ssl:127.0.0.1:3376,cert=/var/lib/boot2docker/server.pem,cafile=/var/lib/boot2docker/ca.pem,key=/var/lib/boot2docker/server-key.pem
volumes:
- /var/lib/boot2docker:/var/lib/boot2docker
8 changes: 8 additions & 0 deletions gruntFile.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ module.exports = function (grunt) {
]);
grunt.registerTask('test-watch', ['karma:watch']);
grunt.registerTask('run', ['if:binaryNotExist', 'build', 'shell:buildImage', 'shell:run']);
grunt.registerTask('runSwarm', ['if:binaryNotExist', 'build', 'shell:buildImage', 'shell:runSwarm']);
grunt.registerTask('run-dev', ['if:binaryNotExist', 'shell:buildImage', 'shell:run', 'watch:build']);

// Print a timestamp (useful for when watching)
Expand Down Expand Up @@ -259,6 +260,13 @@ module.exports = function (grunt) {
'docker run --privileged -d -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock --name dockerui dockerui'
].join(';')
},
runSwarm: {
command: [
'docker stop dockerui',
'docker rm dockerui',
'docker run --net=host -d --name dockerui dockerui -e http://127.0.0.1:2374'
].join(';')
},
cleanImages: {
command: 'docker rmi $(docker images -q -f dangling=true)'
}
Expand Down

0 comments on commit 49d4c58

Please sign in to comment.