Skip to content

Instantly share code, notes, and snippets.

View ajeetraina's full-sized avatar
💭
Whalify Yourself !

Ajeet Singh Raina, Docker Captain, ARM Innovator, ajeetraina

💭
Whalify Yourself !
View GitHub Profile
@ajeetraina
ajeetraina / gist:484f506e26d689b48b4dbef1f06943c3
Created June 24, 2016 06:23
docker-swarm-before-11.2-rc2
Docker Swarm before 1.12rc2:
1. Setting up Consul for Docker Swarm
sudo docker run --restart=unless-stopped -d -p 8500:8500 -h consul1 progrium/consul -server -bootstrap
2. Setting up Swarm Manager to work with Consul
docker run -d -p 4000:4000 swarm manage -H :4000 --replication --advertise 10.142.0.2:4000 consul://10.142.0.2:8500
Getting started with Docker:
1. First Container
root@master1:~# docker run busybox echo hello world
hello world
What we did?
. We used one of the smallest, simplest images available: busybox.
• busybox is typically used in embedded systems (phones, routers...)
Day - 6/29/2016
1. Installing Docker
#apt-get install docker*
2. Checking the version
#docker version
Machine: Your Laptop
Cloud: Google Cloud Engine
Open The PowerSHell and start running these commands:
$ gcloud auth login
$ docker-machine create --driver google --google-project collabnixx-1346 test-master1
$docker-machine ssh test-master1
But it throws garbage value when you try to do backspace...
@ajeetraina
ajeetraina / gist:1b9fbb69509e84c72811cbb75fcffff0
Last active August 27, 2016 04:13
Demo- Service Discovery
$sudo docker service create --env WORDPRESS_DB_HOST=wordpressdb1 --env WORDPRESS_DB_PASSWORD=collab123 --network collabnet --replicas 4 --name wordpressapp --publish 80:80/tcp wordpress:latest
$sudo docker service create --env WORDPRESS_DB_HOST=wordpressdb --env WORDPRESS_DB_PASSWORD=collab123 --network collabnet --replicas 4 --name wordpressapp --publish 80:80/tcp wordpress:latest
$sudo docker service create --replicas 1 --name wordpressdb1 --network collabnet --env MYSQL_ROOT_PASSWORD=collab123 --env MYSQL_DATABASE=wordpress mysql:latest
$sudo docker service inspect \
--format=='{{json .Endpoint.VirtualIPs}}' \
wordpressapp
Hope:
`--opt encrypted` flag ~ an optional which enables an additional layer of encryption in the overlay driver for vxlan traffic between containers on different nodes
`--subnet` flag ~ specifies the subnet for use with the overlay network. When you don't specify a subnet, the swarm manager automatically chooses a subnet and assigns it to the network.
Note - Before you attach a service to the network, the network only extends to manager nodes
ingress - This is the overlay network on which all exposed ports exist. As explained below, ingress ports are numbered from 30000 through 32000 (user configurable range) and follow a node port model in which each service has the same port on every node in the cluster.
docker_gwbridge - This is the default gateway network. It is the only network with connectivity to the outside.
[user-defined overlay] - This is the overlay network that the user has specified that the container should be on. In the example above, it is mynetwork. Note that a container can be on m
@ajeetraina
ajeetraina / gist:6831a5e2e7c6e4955f1a4af8b7693293
Last active September 25, 2016 16:40
Testing Node Labels under Docker 1.12 Swarm Mode
Platform: Google Cloud
Docker Version: 1.12.1
Setting up Master-1:
master ==>sudo docker swarm init --listen-addr 10.140.0.3
Swarm initialized: current node (doc7u22kg42bo9x0zrjbwtk86) is now a manager.
To add a worker to this swarm, run the following command:
docker swarm join \
--token SWMTKN-1-02u85v6ggoj4em6e5v6rbjemgo9q324i9sced6dqkr54dyh3k8-68mxomvfy0htjbqm51dz60rtl \
@ajeetraina
ajeetraina / Getting Started with Infrakit
Created October 8, 2016 09:57
Getting Started with Infrakit
Steps:(I tested it as root user just for quick setup)
#cat script-test
export PATH=/usr/local/go/bin:$PATH
mkdir -p ~/go
export GOPATH=!$
export PATH=$GOPATH/bin:$PATH
mkdir -p ~/go/src/github.com/docker
cd !$
@ajeetraina
ajeetraina / gist:1cc2213789c0ff7923d9dc06fbbc63d5
Created October 28, 2016 08:38
Testing Docker-Compose for MongoDB & Node.js
sudo docker run -d --name mdb5 mongo
adc6dda648fa206736dc5cd1a4f99319244819fdd0cb1c188902034558e6d501
sudo docker ps
CONTAINER ID IMAGE COMMAND CREATED STATU
S PORTS NAMES
adc6dda648fa mongo "/entrypoint.sh mongo" 36 seconds ago Up 35
seconds 27017/tcp mdb5
$ sudo docker run -p 27017:27017 --name db --link mdb5:mdb5 mongo
$ sudo docker volume inspect virajsingh9sep_volume_with_label
[
{
"Name": "virajsingh9sep_volume_with_label",
"Driver": "local",
"Mountpoint": "/var/lib/docker/volumes/virajsingh9sep_volume_with_label/_data",
"Labels": {
"alpha": "beta"
},
"Scope": "local"