Skip to content

Instantly share code, notes, and snippets.

@ajeetraina
Last active September 14, 2017 19:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ajeetraina/a16b2338d4f1995416def55e01e933fa to your computer and use it in GitHub Desktop.
Save ajeetraina/a16b2338d4f1995416def55e01e933fa to your computer and use it in GitHub Desktop.
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...
& "C:\Program Files\Git\bin\bash.exe" - Run this command on local powershell C: prompt
How to add nodes straight from the master node:
rm -fr /var/run/docker.sock
&
dockerd -H tcp://0.0.0.0:55555 &
Now go to master node and run the below command:
DOCKER_HOST=tcp://node-2:55555 docker swarm join test-master1:2377
============
Incase your machine goes down and complain about if docker daemon is running at this node?
Use the below dockerd and containerd commands:
sudo ps -aef | grep docker
root 2452 1 0 13:25 ? 00:00:00 dockerd -H tcp://0.0.0.0:2376 -H unix:///var/run/docker.sock --st
orage-driver aufs --tlsverify --tlscacert /etc/docker/ca.pem --tlscert /etc/docker/server.pem --tlskey /etc/docke
r/server-key.pem --label provider=google
root 2459 2452 0 13:25 ? 00:00:00 docker-containerd -l unix:///var/run/docker/libcontainerd/docker-
containerd.sock --shim docker-containerd-shim --metrics-interval=0 --start-timeout 2m --state-dir /var/run/docker
/libcontainerd/containerd --runtime docker-runc
3 Command lines to heaven:
docker network create --driver overlay wordpressnet
docker service create --env MYSQL_ROOT_PASSWORD=collab123 --env MYSQL_DATABASE=wordpress --network wordpressnet --replicas 1 --name wordpressdb mysql:latest
docker service create --env WORDPRESS_DB_HOST=wordpressdb --env WORDPRESS_DB_PASSWORD=collab123 --network wordpressnet --replicas 4 --name wordpressapp --publish 80:80/tcp wordpress:latest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment