Giter Site home page Giter Site logo

dockerswarm_learnings_windows10's Introduction

dockerswarmlearnings_windows10

My experience with Docker Swarm.

powershell should be configured in PATH.
Make sure the below PATH is configured in PATH Environment Variable.
C:\Windows\System32\WindowsPowerShell\v1.0

executing docker-machine should be done in powershell admin mode or else the below error will come.
Below 2 options can be choosed to create Docker Hosts as per your environment
docker-machine create --driver hyperv manager1
docker-machine create --driver virtualbox manager1

Make sure you trigger the above cmd from Powershell or CMD as Administrator or else the below error will come.

Running pre-create checks...
Error with pre-create check: "Hyper-v commands have to be run as an Administrator"

Make sure external vswitch is enabled, or else you may face the below issue.

no External vswitch found. A valid vswitch must be available for this command to run.

Create a virtual switch by using Windows PowerShell, if it is not available in your Windows.

Find existing network adapters by running the Get-NetAdapter cmdlet.
--> Get-NetAdapter

Create a virtual switch by using the New-VMSwitch cmdlet.
--> New-VMSwitch -name ExternalSwitch -NetAdapterName Ethernet -AllowManagementOS $true

To create an internal switch, run the following command.
--> New-VMSwitch -name InternalSwitch -SwitchType Internal

To create an private switch, run the following command.
--> New-VMSwitch -name PrivateSwitch -SwitchType Private

Once the manager node is created, creae rest nodes as per your requirement.

docker-machine --debug create -d hyperv dockernode1
docker-machine --debug create -d hyperv dockernode2
docker-machine --debug create -d hyperv dockernode3

Initialize Master node into Docker Swarm.

docker-machine ssh manager1
docker swarm init --advertise-addr
[You can find out the IP by the command: docker-machine ip manager1]

Join the worker nodes into Docker Swarm.

docker-machine ssh dockernode1
docker swarm join --token :2377
[SAME SHOULD BE DONE FOR THE REST WORKER NODEs].

For Fault Tolerance for Docker Swarm Managers, we should have odd no of managers (5/7/9).

docker-machine --debug create -d hyper manager2 ## create an additional docker manager host.
docker-machine ssh manager2 ## ssh into the newly created manager
docker swarm join-token manager ## execute this command to generate a token from the actual manager.
docker swarm join --token :2377

docker-machine --debug create -d hyper manager3 ## create an additional docker manager host.
docker-machine ssh manager3 ## ssh into the newly created manager
docker swarm join-token manager ## execute this command to generate a token from the actual manager.
docker swarm join --token :2377

docker-machine --debug create -d hyper manager4 ## create an additional docker manager host.
docker-machine ssh manager4 ## ssh into the newly created manager
docker swarm join-token manager ## execute this command to generate a token from the actual manager.
docker swarm join --token :2377

docker-machine --debug create -d hyper manager5 ## create an additional docker manager host.
docker-machine ssh manager5 ## ssh into the newly created manager
docker swarm join-token manager ## execute this command to generate a token from the actual manager.
docker swarm join --token :2377

Details of the Docker Swarm Cluster can be found using the below command.

docker node ls ## this command should be executed from the docker master host. alt text

Create service of images/applications etc in Docker Swarm Cluster using the below command.

docker service create --replicas 5 -d -p 9090:80 --name webserver nginx

Confirm the nginx services is running after sometime [you need to wait for sometime for the above service to run].

alt text

Scaling up/down the no of application instances in Docker Swarm.

docker service scale webserver=10

dockerswarm_learnings_windows10's People

Contributors

sanjibbehera avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.