You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1249 lines
410 KiB

3 years ago
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="Asciidoctor 2.0.10">
<meta name="description" content="IoT Εισαγωγή στο Swarm">
<meta name="keywords" content="Cloud, swarm">
<meta name="author" content="Apostolos rootApostolos@swarmlab.io">
<title>Swarm !</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:300,300italic,400,400italic,600,600italic%7CNoto+Serif:400,400italic,700,700italic%7CDroid+Sans+Mono:400,700">
<style>
/* Asciidoctor default stylesheet | MIT License | https://asciidoctor.org */
/* Uncomment @import statement to use as custom stylesheet */
/*@import "https://fonts.googleapis.com/css?family=Open+Sans:300,300italic,400,400italic,600,600italic%7CNoto+Serif:400,400italic,700,700italic%7CDroid+Sans+Mono:400,700";*/
article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}
audio,video{display:inline-block}
audio:not([controls]){display:none;height:0}
html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}
a{background:none}
a:focus{outline:thin dotted}
a:active,a:hover{outline:0}
h1{font-size:2em;margin:.67em 0}
abbr[title]{border-bottom:1px dotted}
b,strong{font-weight:bold}
dfn{font-style:italic}
hr{-moz-box-sizing:content-box;box-sizing:content-box;height:0}
mark{background:#ff0;color:#000}
code,kbd,pre,samp{font-family:monospace;font-size:1em}
pre{white-space:pre-wrap}
q{quotes:"\201C" "\201D" "\2018" "\2019"}
small{font-size:80%}
sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}
sup{top:-.5em}
sub{bottom:-.25em}
img{border:0}
svg:not(:root){overflow:hidden}
figure{margin:0}
fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}
legend{border:0;padding:0}
button,input,select,textarea{font-family:inherit;font-size:100%;margin:0}
button,input{line-height:normal}
button,select{text-transform:none}
button,html input[type="button"],input[type="reset"],input[type="submit"]{-webkit-appearance:button;cursor:pointer}
button[disabled],html input[disabled]{cursor:default}
input[type="checkbox"],input[type="radio"]{box-sizing:border-box;padding:0}
button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}
textarea{overflow:auto;vertical-align:top}
table{border-collapse:collapse;border-spacing:0}
*,*::before,*::after{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}
html,body{font-size:100%}
body{background:#fff;color:rgba(0,0,0,.8);padding:0;margin:0;font-family:"Noto Serif","DejaVu Serif",serif;font-weight:400;font-style:normal;line-height:1;position:relative;cursor:auto;tab-size:4;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}
a:hover{cursor:pointer}
img,object,embed{max-width:100%;height:auto}
object,embed{height:100%}
img{-ms-interpolation-mode:bicubic}
.left{float:left!important}
.right{float:right!important}
.text-left{text-align:left!important}
.text-right{text-align:right!important}
.text-center{text-align:center!important}
.text-justify{text-align:justify!important}
.hide{display:none}
img,object,svg{display:inline-block;vertical-align:middle}
textarea{height:auto;min-height:50px}
select{width:100%}
.center{margin-left:auto;margin-right:auto}
.stretch{width:100%}
.subheader,.admonitionblock td.content>.title,.audioblock>.title,.exampleblock>.title,.imageblock>.title,.listingblock>.title,.literalblock>.title,.stemblock>.title,.openblock>.title,.paragraph>.title,.quoteblock>.title,table.tableblock>.title,.verseblock>.title,.videoblock>.title,.dlist>.title,.olist>.title,.ulist>.title,.qlist>.title,.hdlist>.title{line-height:1.45;color:#7a2518;font-weight:400;margin-top:0;margin-bottom:.25em}
div,dl,dt,dd,ul,ol,li,h1,h2,h3,#toctitle,.sidebarblock>.content>.title,h4,h5,h6,pre,form,p,blockquote,th,td{margin:0;padding:0;direction:ltr}
a{color:#2156a5;text-decoration:underline;line-height:inherit}
a:hover,a:focus{color:#1d4b8f}
a img{border:0}
p{font-family:inherit;font-weight:400;font-size:1em;line-height:1.6;margin-bottom:1.25em;text-rendering:optimizeLegibility}
p aside{font-size:.875em;line-height:1.35;font-style:italic}
h1,h2,h3,#toctitle,.sidebarblock>.content>.title,h4,h5,h6{font-family:"Open Sans","DejaVu Sans",sans-serif;font-weight:300;font-style:normal;color:#ba3925;text-rendering:optimizeLegibility;margin-top:1em;margin-bottom:.5em;line-height:1.0125em}
h1 small,h2 small,h3 small,#toctitle small,.sidebarblock>.content>.title small,h4 small,h5 small,h6 small{font-size:60%;color:#e99b8f;line-height:0}
h1{font-size:2.125em}
h2{font-size:1.6875em}
h3,#toctitle,.sidebarblock>.content>.title{font-size:1.375em}
h4,h5{font-size:1.125em}
h6{font-size:1em}
hr{border:solid #dddddf;border-width:1px 0 0;clear:both;margin:1.25em 0 1.1875em;height:0}
em,i{font-style:italic;line-height:inherit}
strong,b{font-weight:bold;line-height:inherit}
small{font-size:60%;line-height:inherit}
code{font-family:"Droid Sans Mono","DejaVu Sans Mono",monospace;font-weight:400;color:rgba(0,0,0,.9)}
ul,ol,dl{font-size:1em;line-height:1.6;margin-bottom:1.25em;list-style-position:outside;font-family:inherit}
ul,ol{margin-left:1.5em}
ul li ul,ul li ol{margin-left:1.25em;margin-bottom:0;font-size:1em}
ul.square li ul,ul.circle li ul,ul.disc li ul{list-style:inherit}
ul.square{list-style-type:square}
ul.circle{list-style-type:circle}
ul.disc{list-style-type:disc}
ol li ul,ol li ol{margin-left:1.25em;margin-bottom:0}
dl dt{margin-bottom:.3125em;font-weight:bold}
dl dd{margin-bottom:1.25em}
abbr,acronym{text-transform:uppercase;font-size:90%;color:rgba(0,0,0,.8);border-bottom:1px dotted #ddd;cursor:help}
abbr{text-transform:none}
blockquote{margin:0 0 1.25em;padding:.5625em 1.25em 0 1.1875em;border-left:1px solid #ddd}
blockquote cite{display:block;font-size:.9375em;color:rgba(0,0,0,.6)}
blockquote cite::before{content:"\2014 \0020"}
blockquote cite a,blockquote cite a:visited{color:rgba(0,0,0,.6)}
blockquote,blockquote p{line-height:1.6;color:rgba(0,0,0,.85)}
@media screen and (min-width:768px){h1,h2,h3,#toctitle,.sidebarblock>.content>.title,h4,h5,h6{line-height:1.2}
h1{font-size:2.75em}
h2{font-size:2.3125em}
h3,#toctitle,.sidebarblock>.content>.title{font-size:1.6875em}
h4{font-size:1.4375em}}
table{background:#fff;margin-bottom:1.25em;border:solid 1px #dedede}
table thead,table tfoot{background:#f7f8f7}
table thead tr th,table thead tr td,table tfoot tr th,table tfoot tr td{padding:.5em .625em .625em;font-size:inherit;color:rgba(0,0,0,.8);text-align:left}
table tr th,table tr td{padding:.5625em .625em;font-size:inherit;color:rgba(0,0,0,.8)}
table tr.even,table tr.alt{background:#f8f8f7}
table thead tr th,table tfoot tr th,table tbody tr td,table tr td,table tfoot tr td{display:table-cell;line-height:1.6}
h1,h2,h3,#toctitle,.sidebarblock>.content>.title,h4,h5,h6{line-height:1.2;word-spacing:-.05em}
h1 strong,h2 strong,h3 strong,#toctitle strong,.sidebarblock>.content>.title strong,h4 strong,h5 strong,h6 strong{font-weight:400}
.clearfix::before,.clearfix::after,.float-group::before,.float-group::after{content:" ";display:table}
.clearfix::after,.float-group::after{clear:both}
:not(pre):not([class^=L])>code{font-size:.9375em;font-style:normal!important;letter-spacing:0;padding:.1em .5ex;word-spacing:-.15em;background:#f7f7f8;-webkit-border-radius:4px;border-radius:4px;line-height:1.45;text-rendering:optimizeSpeed;word-wrap:break-word}
:not(pre)>code.nobreak{word-wrap:normal}
:not(pre)>code.nowrap{white-space:nowrap}
pre{color:rgba(0,0,0,.9);font-family:"Droid Sans Mono","DejaVu Sans Mono",monospace;line-height:1.45;text-rendering:optimizeSpeed}
pre code,pre pre{color:inherit;font-size:inherit;line-height:inherit}
pre>code{display:block}
pre.nowrap,pre.nowrap pre{white-space:pre;word-wrap:normal}
em em{font-style:normal}
strong strong{font-weight:400}
.keyseq{color:rgba(51,51,51,.8)}
kbd{font-family:"Droid Sans Mono","DejaVu Sans Mono",monospace;display:inline-block;color:rgba(0,0,0,.8);font-size:.65em;line-height:1.45;background:#f7f7f7;border:1px solid #ccc;-webkit-border-radius:3px;border-radius:3px;-webkit-box-shadow:0 1px 0 rgba(0,0,0,.2),0 0 0 .1em white inset;box-shadow:0 1px 0 rgba(0,0,0,.2),0 0 0 .1em #fff inset;margin:0 .15em;padding:.2em .5em;vertical-align:middle;position:relative;top:-.1em;white-space:nowrap}
.keyseq kbd:first-child{margin-left:0}
.keyseq kbd:last-child{margin-right:0}
.menuseq,.menuref{color:#000}
.menuseq b:not(.caret),.menuref{font-weight:inherit}
.menuseq{word-spacing:-.02em}
.menuseq b.caret{font-size:1.25em;line-height:.8}
.menuseq i.caret{font-weight:bold;text-align:center;width:.45em}
b.button::before,b.button::after{position:relative;top:-1px;font-weight:400}
b.button::before{content:"[";padding:0 3px 0 2px}
b.button::after{content:"]";padding:0 2px 0 3px}
p a>code:hover{color:rgba(0,0,0,.9)}
#header,#content,#footnotes,#footer{width:100%;margin-left:auto;margin-right:auto;margin-top:0;margin-bottom:0;max-width:62.5em;*zoom:1;position:relative;padding-left:.9375em;padding-right:.9375em}
#header::before,#header::after,#content::before,#content::after,#footnotes::before,#footnotes::after,#footer::before,#footer::after{content:" ";display:table}
#header::after,#content::after,#footnotes::after,#footer::after{clear:both}
#content{margin-top:1.25em}
#content::before{content:none}
#header>h1:first-child{color:rgba(0,0,0,.85);margin-top:2.25rem;margin-bottom:0}
#header>h1:first-child+#toc{margin-top:8px;border-top:1px solid #dddddf}
#header>h1:only-child,body.toc2 #header>h1:nth-last-child(2){border-bottom:1px solid #dddddf;padding-bottom:8px}
#header .details{border-bottom:1px solid #dddddf;line-height:1.45;padding-top:.25em;padding-bottom:.25em;padding-left:.25em;color:rgba(0,0,0,.6);display:-ms-flexbox;display:-webkit-flex;display:flex;-ms-flex-flow:row wrap;-webkit-flex-flow:row wrap;flex-flow:row wrap}
#header .details span:first-child{margin-left:-.125em}
#header .details span.email a{color:rgba(0,0,0,.85)}
#header .details br{display:none}
#header .details br+span::before{content:"\00a0\2013\00a0"}
#header .details br+span.author::before{content:"\00a0\22c5\00a0";color:rgba(0,0,0,.85)}
#header .details br+span#revremark::before{content:"\00a0|\00a0"}
#header #revnumber{text-transform:capitalize}
#header #revnumber::after{content:"\00a0"}
#content>h1:first-child:not([class]){color:rgba(0,0,0,.85);border-bottom:1px solid #dddddf;padding-bottom:8px;margin-top:0;padding-top:1rem;margin-bottom:1.25rem}
#toc{border-bottom:1px solid #e7e7e9;padding-bottom:.5em}
#toc>ul{margin-left:.125em}
#toc ul.sectlevel0>li>a{font-style:italic}
#toc ul.sectlevel0 ul.sectlevel1{margin:.5em 0}
#toc ul{font-family:"Open Sans","DejaVu Sans",sans-serif;list-style-type:none}
#toc li{line-height:1.3334;margin-top:.3334em}
#toc a{text-decoration:none}
#toc a:active{text-decoration:underline}
#toctitle{color:#7a2518;font-size:1.2em}
@media screen and (min-width:768px){#toctitle{font-size:1.375em}
body.toc2{padding-left:15em;padding-right:0}
#toc.toc2{margin-top:0!important;background:#f8f8f7;position:fixed;width:15em;left:0;top:0;border-right:1px solid #e7e7e9;border-top-width:0!important;border-bottom-width:0!important;z-index:1000;padding:1.25em 1em;height:100%;overflow:auto}
#toc.toc2 #toctitle{margin-top:0;margin-bottom:.8rem;font-size:1.2em}
#toc.toc2>ul{font-size:.9em;margin-bottom:0}
#toc.toc2 ul ul{margin-left:0;padding-left:1em}
#toc.toc2 ul.sectlevel0 ul.sectlevel1{padding-left:0;margin-top:.5em;margin-bottom:.5em}
body.toc2.toc-right{padding-left:0;padding-right:15em}
body.toc2.toc-right #toc.toc2{border-right-width:0;border-left:1px solid #e7e7e9;left:auto;right:0}}
@media screen and (min-width:1280px){body.toc2{padding-left:20em;padding-right:0}
#toc.toc2{width:20em}
#toc.toc2 #toctitle{font-size:1.375em}
#toc.toc2>ul{font-size:.95em}
#toc.toc2 ul ul{padding-left:1.25em}
body.toc2.toc-right{padding-left:0;padding-right:20em}}
#content #toc{border-style:solid;border-width:1px;border-color:#e0e0dc;margin-bottom:1.25em;padding:1.25em;background:#f8f8f7;-webkit-border-radius:4px;border-radius:4px}
#content #toc>:first-child{margin-top:0}
#content #toc>:last-child{margin-bottom:0}
#footer{max-width:100%;background:rgba(0,0,0,.8);padding:1.25em}
#footer-text{color:rgba(255,255,255,.8);line-height:1.44}
#content{margin-bottom:.625em}
.sect1{padding-bottom:.625em}
@media screen and (min-width:768px){#content{margin-bottom:1.25em}
.sect1{padding-bottom:1.25em}}
.sect1:last-child{padding-bottom:0}
.sect1+.sect1{border-top:1px solid #e7e7e9}
#content h1>a.anchor,h2>a.anchor,h3>a.anchor,#toctitle>a.anchor,.sidebarblock>.content>.title>a.anchor,h4>a.anchor,h5>a.anchor,h6>a.anchor{position:absolute;z-index:1001;width:1.5ex;margin-left:-1.5ex;display:block;text-decoration:none!important;visibility:hidden;text-align:center;font-weight:400}
#content h1>a.anchor::before,h2>a.anchor::before,h3>a.anchor::before,#toctitle>a.anchor::before,.sidebarblock>.content>.title>a.anchor::before,h4>a.anchor::before,h5>a.anchor::before,h6>a.anchor::before{content:"\00A7";font-size:.85em;display:block;padding-top:.1em}
#content h1:hover>a.anchor,#content h1>a.anchor:hover,h2:hover>a.anchor,h2>a.anchor:hover,h3:hover>a.anchor,#toctitle:hover>a.anchor,.sidebarblock>.content>.title:hover>a.anchor,h3>a.anchor:hover,#toctitle>a.anchor:hover,.sidebarblock>.content>.title>a.anchor:hover,h4:hover>a.anchor,h4>a.anchor:hover,h5:hover>a.anchor,h5>a.anchor:hover,h6:hover>a.anchor,h6>a.anchor:hover{visibility:visible}
#content h1>a.link,h2>a.link,h3>a.link,#toctitle>a.link,.sidebarblock>.content>.title>a.link,h4>a.link,h5>a.link,h6>a.link{color:#ba3925;text-decoration:none}
#content h1>a.link:hover,h2>a.link:hover,h3>a.link:hover,#toctitle>a.link:hover,.sidebarblock>.content>.title>a.link:hover,h4>a.link:hover,h5>a.link:hover,h6>a.link:hover{color:#a53221}
details,.audioblock,.imageblock,.literalblock,.listingblock,.stemblock,.videoblock{margin-bottom:1.25em}
details>summary:first-of-type{cursor:pointer;display:list-item;outline:none;margin-bottom:.75em}
.admonitionblock td.content>.title,.audioblock>.title,.exampleblock>.title,.imageblock>.title,.listingblock>.title,.literalblock>.title,.stemblock>.title,.openblock>.title,.paragraph>.title,.quoteblock>.title,table.tableblock>.title,.verseblock>.title,.videoblock>.title,.dlist>.title,.olist>.title,.ulist>.title,.qlist>.title,.hdlist>.title{text-rendering:optimizeLegibility;text-align:left;font-family:"Noto Serif","DejaVu Serif",serif;font-size:1rem;font-style:italic}
table.tableblock.fit-content>caption.title{white-space:nowrap;width:0}
.paragraph.lead>p,#preamble>.sectionbody>[class="paragraph"]:first-of-type p{font-size:1.21875em;line-height:1.6;color:rgba(0,0,0,.85)}
table.tableblock #preamble>.sectionbody>[class="paragraph"]:first-of-type p{font-size:inherit}
.admonitionblock>table{border-collapse:separate;border:0;background:none;width:100%}
.admonitionblock>table td.icon{text-align:center;width:80px}
.admonitionblock>table td.icon img{max-width:none}
.admonitionblock>table td.icon .title{font-weight:bold;font-family:"Open Sans","DejaVu Sans",sans-serif;text-transform:uppercase}
.admonitionblock>table td.content{padding-left:1.125em;padding-right:1.25em;border-left:1px solid #dddddf;color:rgba(0,0,0,.6)}
.admonitionblock>table td.content>:last-child>:last-child{margin-bottom:0}
.exampleblock>.content{border-style:solid;border-width:1px;border-color:#e6e6e6;margin-bottom:1.25em;padding:1.25em;background:#fff;-webkit-border-radius:4px;border-radius:4px}
.exampleblock>.content>:first-child{margin-top:0}
.exampleblock>.content>:last-child{margin-bottom:0}
.sidebarblock{border-style:solid;border-width:1px;border-color:#dbdbd6;margin-bottom:1.25em;padding:1.25em;background:#f3f3f2;-webkit-border-radius:4px;border-radius:4px}
.sidebarblock>:first-child{margin-top:0}
.sidebarblock>:last-child{margin-bottom:0}
.sidebarblock>.content>.title{color:#7a2518;margin-top:0;text-align:center}
.exampleblock>.content>:last-child>:last-child,.exampleblock>.content .olist>ol>li:last-child>:last-child,.exampleblock>.content .ulist>ul>li:last-child>:last-child,.exampleblock>.content .qlist>ol>li:last-child>:last-child,.sidebarblock>.content>:last-child>:last-child,.sidebarblock>.content .olist>ol>li:last-child>:last-child,.sidebarblock>.content .ulist>ul>li:last-child>:last-child,.sidebarblock>.content .qlist>ol>li:last-child>:last-child{margin-bottom:0}
.literalblock pre,.listingblock>.content>pre{-webkit-border-radius:4px;border-radius:4px;word-wrap:break-word;overflow-x:auto;padding:1em;font-size:.8125em}
@media screen and (min-width:768px){.literalblock pre,.listingblock>.content>pre{font-size:.90625em}}
@media screen and (min-width:1280px){.literalblock pre,.listingblock>.content>pre{font-size:1em}}
.literalblock pre,.listingblock>.content>pre:not(.highlight),.listingblock>.content>pre[class="highlight"],.listingblock>.content>pre[class^="highlight "]{background:#f7f7f8}
.literalblock.output pre{color:#f7f7f8;background:rgba(0,0,0,.9)}
.listingblock>.content{position:relative}
.listingblock code[data-lang]::before{display:none;content:attr(data-lang);position:absolute;font-size:.75em;top:.425rem;right:.5rem;line-height:1;text-transform:uppercase;color:inherit;opacity:.5}
.listingblock:hover code[data-lang]::before{display:block}
.listingblock.terminal pre .command::before{content:attr(data-prompt);padding-right:.5em;color:inherit;opacity:.5}
.listingblock.terminal pre .command:not([data-prompt])::before{content:"$"}
.listingblock pre.highlightjs{padding:0}
.listingblock pre.highlightjs>code{padding:1em;-webkit-border-radius:4px;border-radius:4px}
.listingblock pre.prettyprint{border-width:0}
.prettyprint{background:#f7f7f8}
pre.prettyprint .linenums{line-height:1.45;margin-left:2em}
pre.prettyprint li{background:none;list-style-type:inherit;padding-left:0}
pre.prettyprint li code[data-lang]::before{opacity:1}
pre.prettyprint li:not(:first-child) code[data-lang]::before{display:none}
table.linenotable{border-collapse:separate;border:0;margin-bottom:0;background:none}
table.linenotable td[class]{color:inherit;vertical-align:top;padding:0;line-height:inherit;white-space:normal}
table.linenotable td.code{padding-left:.75em}
table.linenotable td.linenos{border-right:1px solid currentColor;opacity:.35;padding-right:.5em}
pre.pygments .lineno{border-right:1px solid currentColor;opacity:.35;display:inline-block;margin-right:.75em}
pre.pygments .lineno::before{content:"";margin-right:-.125em}
.quoteblock{margin:0 1em 1.25em 1.5em;display:table}
.quoteblock:not(.excerpt)>.title{margin-left:-1.5em;margin-bottom:.75em}
.quoteblock blockquote,.quoteblock p{color:rgba(0,0,0,.85);font-size:1.15rem;line-height:1.75;word-spacing:.1em;letter-spacing:0;font-style:italic;text-align:justify}
.quoteblock blockquote{margin:0;padding:0;border:0}
.quoteblock blockquote::before{content:"\201c";float:left;font-size:2.75em;font-weight:bold;line-height:.6em;margin-left:-.6em;color:#7a2518;text-shadow:0 1px 2px rgba(0,0,0,.1)}
.quoteblock blockquote>.paragraph:last-child p{margin-bottom:0}
.quoteblock .attribution{margin-top:.75em;margin-right:.5ex;text-align:right}
.verseblock{margin:0 1em 1.25em}
.verseblock pre{font-family:"Open Sans","DejaVu Sans",sans;font-size:1.15rem;color:rgba(0,0,0,.85);font-weight:300;text-rendering:optimizeLegibility}
.verseblock pre strong{font-weight:400}
.verseblock .attribution{margin-top:1.25rem;margin-left:.5ex}
.quoteblock .attribution,.verseblock .attribution{font-size:.9375em;line-height:1.45;font-style:italic}
.quoteblock .attribution br,.verseblock .attribution br{display:none}
.quoteblock .attribution cite,.verseblock .attribution cite{display:block;letter-spacing:-.025em;color:rgba(0,0,0,.6)}
.quoteblock.abstract blockquote::before,.quoteblock.excerpt blockquote::before,.quoteblock .quoteblock blockquote::before{display:none}
.quoteblock.abstract blockquote,.quoteblock.abstract p,.quoteblock.excerpt blockquote,.quoteblock.excerpt p,.quoteblock .quoteblock blockquote,.quoteblock .quoteblock p{line-height:1.6;word-spacing:0}
.quoteblock.abstract{margin:0 1em 1.25em;display:block}
.quoteblock.abstract>.title{margin:0 0 .375em;font-size:1.15em;text-align:center}
.quoteblock.excerpt>blockquote,.quoteblock .quoteblock{padding:0 0 .25em 1em;border-left:.25em solid #dddddf}
.quoteblock.excerpt,.quoteblock .quoteblock{margin-left:0}
.quoteblock.excerpt blockquote,.quoteblock.excerpt p,.quoteblock .quoteblock blockquote,.quoteblock .quoteblock p{color:inherit;font-size:1.0625rem}
.quoteblock.excerpt .attribution,.quoteblock .quoteblock .attribution{color:inherit;text-align:left;margin-right:0}
table.tableblock{max-width:100%;border-collapse:separate}
p.tableblock:last-child{margin-bottom:0}
td.tableblock>.content>:last-child{margin-bottom:-1.25em}
td.tableblock>.content>:last-child.sidebarblock{margin-bottom:0}
table.tableblock,th.tableblock,td.tableblock{border:0 solid #dedede}
table.grid-all>thead>tr>.tableblock,table.grid-all>tbody>tr>.tableblock{border-width:0 1px 1px 0}
table.grid-all>tfoot>tr>.tableblock{border-width:1px 1px 0 0}
table.grid-cols>*>tr>.tableblock{border-width:0 1px 0 0}
table.grid-rows>thead>tr>.tableblock,table.grid-rows>tbody>tr>.tableblock{border-width:0 0 1px}
table.grid-rows>tfoot>tr>.tableblock{border-width:1px 0 0}
table.grid-all>*>tr>.tableblock:last-child,table.grid-cols>*>tr>.tableblock:last-child{border-right-width:0}
table.grid-all>tbody>tr:last-child>.tableblock,table.grid-all>thead:last-child>tr>.tableblock,table.grid-rows>tbody>tr:last-child>.tableblock,table.grid-rows>thead:last-child>tr>.tableblock{border-bottom-width:0}
table.frame-all{border-width:1px}
table.frame-sides{border-width:0 1px}
table.frame-topbot,table.frame-ends{border-width:1px 0}
table.stripes-all tr,table.stripes-odd tr:nth-of-type(odd),table.stripes-even tr:nth-of-type(even),table.stripes-hover tr:hover{background:#f8f8f7}
th.halign-left,td.halign-left{text-align:left}
th.halign-right,td.halign-right{text-align:right}
th.halign-center,td.halign-center{text-align:center}
th.valign-top,td.valign-top{vertical-align:top}
th.valign-bottom,td.valign-bottom{vertical-align:bottom}
th.valign-middle,td.valign-middle{vertical-align:middle}
table thead th,table tfoot th{font-weight:bold}
tbody tr th{display:table-cell;line-height:1.6;background:#f7f8f7}
tbody tr th,tbody tr th p,tfoot tr th,tfoot tr th p{color:rgba(0,0,0,.8);font-weight:bold}
p.tableblock>code:only-child{background:none;padding:0}
p.tableblock{font-size:1em}
ol{margin-left:1.75em}
ul li ol{margin-left:1.5em}
dl dd{margin-left:1.125em}
dl dd:last-child,dl dd:last-child>:last-child{margin-bottom:0}
ol>li p,ul>li p,ul dd,ol dd,.olist .olist,.ulist .ulist,.ulist .olist,.olist .ulist{margin-bottom:.625em}
ul.checklist,ul.none,ol.none,ul.no-bullet,ol.no-bullet,ol.unnumbered,ul.unstyled,ol.unstyled{list-style-type:none}
ul.no-bullet,ol.no-bullet,ol.unnumbered{margin-left:.625em}
ul.unstyled,ol.unstyled{margin-left:0}
ul.checklist{margin-left:.625em}
ul.checklist li>p:first-child>.fa-square-o:first-child,ul.checklist li>p:first-child>.fa-check-square-o:first-child{width:1.25em;font-size:.8em;position:relative;bottom:.125em}
ul.checklist li>p:first-child>input[type="checkbox"]:first-child{margin-right:.25em}
ul.inline{display:-ms-flexbox;display:-webkit-box;display:flex;-ms-flex-flow:row wrap;-webkit-flex-flow:row wrap;flex-flow:row wrap;list-style:none;margin:0 0 .625em -1.25em}
ul.inline>li{margin-left:1.25em}
.unstyled dl dt{font-weight:400;font-style:normal}
ol.arabic{list-style-type:decimal}
ol.decimal{list-style-type:decimal-leading-zero}
ol.loweralpha{list-style-type:lower-alpha}
ol.upperalpha{list-style-type:upper-alpha}
ol.lowerroman{list-style-type:lower-roman}
ol.upperroman{list-style-type:upper-roman}
ol.lowergreek{list-style-type:lower-greek}
.hdlist>table,.colist>table{border:0;background:none}
.hdlist>table>tbody>tr,.colist>table>tbody>tr{background:none}
td.hdlist1,td.hdlist2{vertical-align:top;padding:0 .625em}
td.hdlist1{font-weight:bold;padding-bottom:1.25em}
.literalblock+.colist,.listingblock+.colist{margin-top:-.5em}
.colist td:not([class]):first-child{padding:.4em .75em 0;line-height:1;vertical-align:top}
.colist td:not([class]):first-child img{max-width:none}
.colist td:not([class]):last-child{padding:.25em 0}
.thumb,.th{line-height:0;display:inline-block;border:solid 4px #fff;-webkit-box-shadow:0 0 0 1px #ddd;box-shadow:0 0 0 1px #ddd}
.imageblock.left{margin:.25em .625em 1.25em 0}
.imageblock.right{margin:.25em 0 1.25em .625em}
.imageblock>.title{margin-bottom:0}
.imageblock.thumb,.imageblock.th{border-width:6px}
.imageblock.thumb>.title,.imageblock.th>.title{padding:0 .125em}
.image.left,.image.right{margin-top:.25em;margin-bottom:.25em;display:inline-block;line-height:0}
.image.left{margin-right:.625em}
.image.right{margin-left:.625em}
a.image{text-decoration:none;display:inline-block}
a.image object{pointer-events:none}
sup.footnote,sup.footnoteref{font-size:.875em;position:static;vertical-align:super}
sup.footnote a,sup.footnoteref a{text-decoration:none}
sup.footnote a:active,sup.footnoteref a:active{text-decoration:underline}
#footnotes{padding-top:.75em;padding-bottom:.75em;margin-bottom:.625em}
#footnotes hr{width:20%;min-width:6.25em;margin:-.25em 0 .75em;border-width:1px 0 0}
#footnotes .footnote{padding:0 .375em 0 .225em;line-height:1.3334;font-size:.875em;margin-left:1.2em;margin-bottom:.2em}
#footnotes .footnote a:first-of-type{font-weight:bold;text-decoration:none;margin-left:-1.05em}
#footnotes .footnote:last-of-type{margin-bottom:0}
#content #footnotes{margin-top:-.625em;margin-bottom:0;padding:.75em 0}
.gist .file-data>table{border:0;background:#fff;width:100%;margin-bottom:0}
.gist .file-data>table td.line-data{width:99%}
div.unbreakable{page-break-inside:avoid}
.big{font-size:larger}
.small{font-size:smaller}
.underline{text-decoration:underline}
.overline{text-decoration:overline}
.line-through{text-decoration:line-through}
.aqua{color:#00bfbf}
.aqua-background{background:#00fafa}
.black{color:#000}
.black-background{background:#000}
.blue{color:#0000bf}
.blue-background{background:#0000fa}
.fuchsia{color:#bf00bf}
.fuchsia-background{background:#fa00fa}
.gray{color:#606060}
.gray-background{background:#7d7d7d}
.green{color:#006000}
.green-background{background:#007d00}
.lime{color:#00bf00}
.lime-background{background:#00fa00}
.maroon{color:#600000}
.maroon-background{background:#7d0000}
.navy{color:#000060}
.navy-background{background:#00007d}
.olive{color:#606000}
.olive-background{background:#7d7d00}
.purple{color:#600060}
.purple-background{background:#7d007d}
.red{color:#bf0000}
.red-background{background:#fa0000}
.silver{color:#909090}
.silver-background{background:#bcbcbc}
.teal{color:#006060}
.teal-background{background:#007d7d}
.white{color:#bfbfbf}
.white-background{background:#fafafa}
.yellow{color:#bfbf00}
.yellow-background{background:#fafa00}
span.icon>.fa{cursor:default}
a span.icon>.fa{cursor:inherit}
.admonitionblock td.icon [class^="fa icon-"]{font-size:2.5em;text-shadow:1px 1px 2px rgba(0,0,0,.5);cursor:default}
.admonitionblock td.icon .icon-note::before{content:"\f05a";color:#19407c}
.admonitionblock td.icon .icon-tip::before{content:"\f0eb";text-shadow:1px 1px 2px rgba(155,155,0,.8);color:#111}
.admonitionblock td.icon .icon-warning::before{content:"\f071";color:#bf6900}
.admonitionblock td.icon .icon-caution::before{content:"\f06d";color:#bf3400}
.admonitionblock td.icon .icon-important::before{content:"\f06a";color:#bf0000}
.conum[data-value]{display:inline-block;color:#fff!important;background:rgba(0,0,0,.8);-webkit-border-radius:100px;border-radius:100px;text-align:center;font-size:.75em;width:1.67em;height:1.67em;line-height:1.67em;font-family:"Open Sans","DejaVu Sans",sans-serif;font-style:normal;font-weight:bold}
.conum[data-value] *{color:#fff!important}
.conum[data-value]+b{display:none}
.conum[data-value]::after{content:attr(data-value)}
pre .conum[data-value]{position:relative;top:-.125em}
b.conum *{color:inherit!important}
.conum:not([data-value]):empty{display:none}
dt,th.tableblock,td.content,div.footnote{text-rendering:optimizeLegibility}
h1,h2,p,td.content,span.alt{letter-spacing:-.01em}
p strong,td.content strong,div.footnote strong{letter-spacing:-.005em}
p,blockquote,dt,td.content,span.alt{font-size:1.0625rem}
p{margin-bottom:1.25rem}
.sidebarblock p,.sidebarblock dt,.sidebarblock td.content,p.tableblock{font-size:1em}
.exampleblock>.content{background:#fffef7;border-color:#e0e0dc;-webkit-box-shadow:0 1px 4px #e0e0dc;box-shadow:0 1px 4px #e0e0dc}
.print-only{display:none!important}
@page{margin:1.25cm .75cm}
@media print{*{-webkit-box-shadow:none!important;box-shadow:none!important;text-shadow:none!important}
html{font-size:80%}
a{color:inherit!important;text-decoration:underline!important}
a.bare,a[href^="#"],a[href^="mailto:"]{text-decoration:none!important}
a[href^="http:"]:not(.bare)::after,a[href^="https:"]:not(.bare)::after{content:"(" attr(href) ")";display:inline-block;font-size:.875em;padding-left:.25em}
abbr[title]::after{content:" (" attr(title) ")"}
pre,blockquote,tr,img,object,svg{page-break-inside:avoid}
thead{display:table-header-group}
svg{max-width:100%}
p,blockquote,dt,td.content{font-size:1em;orphans:3;widows:3}
h2,h3,#toctitle,.sidebarblock>.content>.title{page-break-after:avoid}
#toc,.sidebarblock,.exampleblock>.content{background:none!important}
#toc{border-bottom:1px solid #dddddf!important;padding-bottom:0!important}
body.book #header{text-align:center}
body.book #header>h1:first-child{border:0!important;margin:2.5em 0 1em}
body.book #header .details{border:0!important;display:block;padding:0!important}
body.book #header .details span:first-child{margin-left:0!important}
body.book #header .details br{display:block}
body.book #header .details br+span::before{content:none!important}
body.book #toc{border:0!important;text-align:left!important;padding:0!important;margin:0!important}
body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-break-before:always}
.listingblock code[data-lang]::before{display:block}
#footer{padding:0 .9375em}
.hide-on-print{display:none!important}
.print-only{display:block!important}
.hide-for-print{display:none!important}
.show-for-print{display:inherit!important}}
@media print,amzn-kf8{#header>h1:first-child{margin-top:1.25rem}
.sect1{padding:0!important}
.sect1+.sect1{border:0}
#footer{background:none}
#footer-text{color:rgba(0,0,0,.6);font-size:.9em}}
@media amzn-kf8{#header,#content,#footnotes,#footer{padding:0}}
</style>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
</head>
<body class="article toc2 toc-right">
<div id="header">
<h1>Swarm !</h1>
<div class="details">
<span id="author" class="author">Apostolos rootApostolos@swarmlab.io</span><br>
</div>
<div id="toc" class="toc2">
<div id="toctitle">Πίνακας περιεχομένων</div>
<ul class="sectlevel1">
<li><a href="#_swarm_intro">1. Swarm - Intro</a></li>
<li><a href="#_swarm_architecture">2. Swarm architecture</a>
<ul class="sectlevel2">
<li><a href="#_manager_nodes">2.1. Manager nodes</a></li>
<li><a href="#_worker_nodes">2.2. Worker nodes</a></li>
</ul>
</li>
<li><a href="#_create_swarm">3. Create swarm</a>
<ul class="sectlevel2">
<li><a href="#_join_token">3.1. Join token</a></li>
<li><a href="#_join_swarm">3.2. Join swarm</a></li>
<li><a href="#_leave_swarm">3.3. Leave swarm</a></li>
</ul>
</li>
<li><a href="#_manage_nodes">4. Manage nodes</a></li>
<li><a href="#_deploy_services_and_tasks">5. Deploy services and Tasks</a>
<ul class="sectlevel2">
<li><a href="#_service_vs_stack">5.1. service vs stack</a></li>
<li><a href="#_build">5.2. Build</a>
<ul class="sectlevel3">
<li><a href="#_create_yaml">5.2.1. Create yaml</a></li>
<li><a href="#_build_2">5.2.2. Build</a></li>
<li><a href="#_list_services">5.2.3. List services</a></li>
<li><a href="#_remove_one_or_more_stacks">5.2.4. Remove one or more stacks</a></li>
<li><a href="#_list_tasks">5.2.5. List tasks</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<div id="content">
<div id="preamble">
<div class="sectionbody">
<div class="paragraph">
<p><br></p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_swarm_intro">1. Swarm - Intro</h2>
<div class="sectionbody">
<div class="paragraph">
<p>Docker Swarm is a <strong>clustering</strong> and <strong>scheduling</strong> tool for Docker containers. With Swarm, IT administrators and developers can establish and manage a cluster of Docker nodes as a single virtual system.</p>
</div>
<div class="paragraph">
<p>Clustering is an important feature for container technology, because it creates a cooperative group of systems that can provide redundancy, enabling Docker Swarm failover if one or more nodes experience an outage.</p>
</div>
<div class="paragraph">
<p>Features:</p>
</div>
<div class="ulist">
<ul>
<li>
<p>Decentralized design: Instead of handling differentiation between node roles at deployment time, the Docker Engine handles any specialization at runtime. You can deploy both kinds of nodes, managers and workers, using the Docker Engine.</p>
</li>
<li>
<p>Scaling: For each service, you can declare the number of tasks you want to run. When you scale up or down, the swarm manager automatically adapts by adding or removing tasks to maintain the desired state.</p>
</li>
<li>
<p>Desired state reconciliation: The swarm manager node constantly monitors the cluster state and reconciles any differences between the actual state and your expressed desired state. For example, if you set up a service to run 10 replicas of a container, and a worker machine hosting two of those replicas crashes, the manager creates two new replicas to replace the replicas that crashed. The swarm manager assigns the new replicas to workers that are running and available.</p>
</li>
<li>
<p>Multi-host networking: You can specify an overlay network for your services. The swarm manager automatically assigns addresses to the containers on the overlay network when it initializes or updates the application.</p>
</li>
<li>
<p>Service discovery: Swarm manager nodes assign each service in the swarm a unique DNS name and load balances running containers. You can query every container running in the swarm through a DNS server embedded in the swarm.</p>
</li>
<li>
<p>Load balancing: You can expose the ports for services to an external load balancer. Internally, the swarm lets you specify how to distribute service containers between nodes.</p>
</li>
<li>
<p>Secure by default: Each node in the swarm enforces TLS mutual authentication and encryption to secure communications between itself and all other nodes. You have the option to use self-signed root certificates or certificates from a custom root CA.</p>
</li>
<li>
<p>Rolling updates: At rollout time you can apply service updates to nodes incrementally. The swarm manager lets you control the delay between service deployment to different sets of nodes. If anything goes wrong, you can roll back to a previous version of the service.</p>
</li>
</ul>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_swarm_architecture">2. Swarm architecture</h2>
<div class="sectionbody">
<div class="paragraph">
<p><span class="image"><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAABLcAAAI2CAIAAAAtpv0eAAH1h0lEQVR4AezXNwGAQBAAMPwb5uidCfZviYt0W7EAAABY/ywf82t6ja/hEhH9peAlAgAAYIkAAABYIgAAAJYIAACAJQIAAGCJAAAAWCIAAACWCAAAgCUCAABgiQAAAFgiAAAAlggAAIAlAgAAYIkAAABYIgAAAJYIAACAJQIAAGCJAAAAWCIAAADZsEQAAAAsEQAAAEsEAADAEgEAALBEAAAALBEAAABLBAAAw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5iuPuBU+9jN26/rO8Rkk4BEbG8F2/iLqddLazrFyk+iPHE0uzC59B/7WM/B2hqXJidX+QTE8/e7Uv38NsZkJB0O6+0e2SBWEUAnkReXFIWGJvIhvV093OPvVzYxGtsbUi8mnbxUVmPEOOKsXYu78yNzPMPXzT1cyISTtBcfOwDT6a+bIEweICOY+MPnubvD4mhwwiuvvb+x689K+8an4ZV+Hgbh3s2JTP+Zk5Zr1CxldDf/KH7ZHJG/K3pfp5E/vTFq7hLaTk1Hyrr60OPHme5+TLc/ffHX8uu6CS+HiJEiX/bhigRNdTu1PGD87saByWK/2CQkJCQkL5+IUoE5IB0X0xkuDqFtYLu/LR9KpcowngT4wlHElYYmS9aR1PWZcLdRWVdBgwCfzH2SCjtE4/geMqJpEW/b1Q3sFi+wUbLwGzxOpqqsZUWe9dibeay9dbLjK2UtU3/t/62KyX9Q1L8c4jYze3d4+OrRWUt1qYTjnSZ8BcVPUubsKuNQ1IeRCLB23s69/gG
</div>
<div class="paragraph">
<p>There are two types of nodes: <strong>managers</strong> and <strong>workers.</strong></p>
</div>
<div class="sect2">
<h3 id="_manager_nodes">2.1. Manager nodes</h3>
<div class="paragraph">
<p>Manager nodes handle cluster management tasks:</p>
</div>
<div class="ulist">
<ul>
<li>
<p>maintaining cluster state</p>
</li>
<li>
<p>scheduling services</p>
</li>
<li>
<p>serving swarm mode HTTP API endpoints</p>
</li>
</ul>
</div>
<div class="paragraph">
<p>Using a Raft implementation, the managers maintain a consistent internal state of the entire swarm and all the services running on it.</p>
</div>
<div class="paragraph">
<p>To take advantage of swarm mode’s fault-tolerance features, Docker recommends you implement an odd number of nodes according to your organization’s high-availability requirements. When you have multiple managers you can recover from the failure of a manager node without downtime.</p>
</div>
<div class="ulist">
<ul>
<li>
<p>A three-manager swarm tolerates a maximum loss of one manager.</p>
</li>
<li>
<p>A five-manager swarm tolerates a maximum simultaneous loss of two manager nodes.</p>
</li>
<li>
<p>An N manager cluster tolerates the loss of at most (N-1)/2 managers.</p>
</li>
</ul>
</div>
</div>
<div class="sect2">
<h3 id="_worker_nodes">2.2. Worker nodes</h3>
<div class="paragraph">
<p>Worker nodes are also instances of Docker Engine whose sole purpose is to execute containers. Worker nodes don’t participate in the Raft distributed state, make scheduling decisions, or serve the swarm mode HTTP API.</p>
</div>
<div class="paragraph">
<p>You can create a swarm of one manager node, but you cannot have a worker node without at least one manager node. By default, all managers are also workers.</p>
</div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_create_swarm">3. Create swarm</h2>
<div class="sectionbody">
<div class="paragraph">
<p>Initialize a swarm. The docker engine targeted by this command becomes a manager in the newly created single-node swarm.</p>
</div>
<div class="listingblock">
<div class="title">create swarm</div>
<div class="content">
<pre class="CodeRay highlight"><code data-lang="sh">docker swarm init --advertise-addr ip
Swarm initialized: current node (bvz81updecsj6wjz393c09vti) is now a manager.
To add a worker to this swarm, run the following command:
docker swarm join \
--token SWMTKN-1-3pu6hszjas19xyp7ghgosyx9k8atbfcr8p2is99znpy26u2lkl-1awxwuwd3z9j1z3puu7rcgdbx \
172.17.0.2:2377
To add a manager to this swarm, run 'docker swarm join-token manager' and follow the instructions.</code></pre>
</div>
</div>
<div class="sect2">
<h3 id="_join_token">3.1. Join token</h3>
<div class="paragraph">
<p>Join tokens are secrets that allow a node to join the swarm.</p>
</div>
<div class="paragraph">
<p>There are two different join tokens available,</p>
</div>
<div class="ulist">
<ul>
<li>
<p>one for the worker role and</p>
</li>
<li>
<p>one for the manager role.</p>
</li>
</ul>
</div>
<div class="listingblock">
<div class="title">join token</div>
<div class="content">
<pre class="CodeRay highlight"><code data-lang="sh">docker swarm join-token worker
To add a worker to this swarm, run the following command:
docker swarm join \
--token SWMTKN-1-3pu6hszjas19xyp7ghgosyx9k8atbfcr8p2is99znpy26u2lkl-1awxwuwd3z9j1z3puu7rcgdbx \
172.17.0.2:2377
docker swarm join-token manager
To add a manager to this swarm, run the following command:
docker swarm join \
--token SWMTKN-1-3pu6hszjas19xyp7ghgosyx9k8atbfcr8p2is99znpy26u2lkl-7p73s1dx5in4tatdymyhg9hu2 \
172.17.0.2:2377</code></pre>
</div>
</div>
</div>
<div class="sect2">
<h3 id="_join_swarm">3.2. Join swarm</h3>
<div class="paragraph">
<p>Join a node to a swarm. The node joins as a manager node or worker node based upon the token you pass with the --token flag. If you pass a manager token, the node joins as a manager. If you pass a worker token, the node joins as a worker.</p>
</div>
<div class="listingblock">
<div class="title">join worker</div>
<div class="content">
<pre class="CodeRay highlight"><code data-lang="sh">docker swarm join --token SWMTKN-1-3pu6hszjas19xyp7ghgosyx9k8atbfcr8p2is99znpy26u2lkl-1awxwuwd3z9j1z3puu7rcgdbx --advertise-addr eth1:2377 192.168.99.121:2377
This node joined a swarm as a worker.</code></pre>
</div>
</div>
<div class="listingblock">
<div class="title">join manager</div>
<div class="content">
<pre class="CodeRay highlight"><code data-lang="sh">docker swarm join --token SWMTKN-1-3pu6hszjas19xyp7ghgosyx9k8atbfcr8p2is99znpy26u2lkl-7p73s1dx5in4tatdymyhg9hu2 --advertise-addr eth1:2377 192.168.99.121:2377
This node joined a swarm as a manager.</code></pre>
</div>
</div>
</div>
<div class="sect2">
<h3 id="_leave_swarm">3.3. Leave swarm</h3>
<div class="paragraph">
<p>When you run this command on a worker, that worker leaves the swarm.</p>
</div>
<div class="listingblock">
<div class="content">
<pre>docker swarm leave</pre>
</div>
</div>
<div class="paragraph">
<p>You can use the <strong>--force</strong> option on a manager to remove it from the swarm.</p>
</div>
<div class="admonitionblock note">
<table>
<tr>
<td class="icon">
<i class="fa icon-note" title="Note"></i>
</td>
<td class="content">
<div class="title">INFO</div>
<div class="paragraph">
<p>The safe way to remove a manager from a swarm is to <strong>demote</strong> it to a worker and then direct it to leave the quorum without using --force</p>
</div>
<div class="listingblock">
<div class="content">
<pre>docker node demote id</pre>
</div>
</div>
</td>
</tr>
</table>
</div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_manage_nodes">4. Manage nodes</h2>
<div class="sectionbody">
<div class="admonitionblock note">
<table>
<tr>
<td class="icon">
<i class="fa icon-note" title="Note"></i>
</td>
<td class="content">
<div class="title">INFO</div>
<div class="paragraph">
<p>This is a cluster management command, and must be executed on a swarm manager node.</p>
</div>
</td>
</tr>
</table>
</div>
<div class="ulist">
<ul>
<li>
<p><strong>docker node ls</strong> List nodes in the swarm</p>
</li>
</ul>
</div>
<div class="listingblock">
<div class="content">
<pre>docker node ls</pre>
</div>
</div>
<div class="ulist">
<ul>
<li>
<p><strong>docker node demote</strong> <code>_ Demote one or more nodes from manager in the swarm_</code></p>
</li>
<li>
<p><strong>docker node inspect</strong> <code>_ Display detailed information on one or more nodes_</code></p>
</li>
<li>
<p><strong>docker node promote</strong> <code>_ Promote one or more nodes to manager in the swarm_</code></p>
</li>
<li>
<p><strong>docker node ps</strong> <code>_ List tasks running on one or more nodes, defaults to current node_</code></p>
</li>
<li>
<p><strong>docker node rm</strong> <code>_ Remove one or more nodes from the swarm_</code></p>
</li>
<li>
<p><strong>docker node update</strong> <code>_ Update a node_</code></p>
</li>
<li>
<p><strong>docker node inspect</strong> <code>_ Display detailed information on one or more nodes_</code></p>
</li>
</ul>
</div>
<div class="listingblock">
<div class="content">
<pre>docker node inspect id # from ls</pre>
</div>
</div>
<div class="listingblock">
<div class="content">
<pre>[
{
"ID": "e216jshn25ckzbvmwlnh5jr3g",
"Version": {
"Index": 10
},
"CreatedAt": "2017-05-16T22:52:44.9910662Z",
"UpdatedAt": "2017-05-16T22:52:45.230878043Z",
"Spec": {
"Role": "manager",
"Availability": "active"
},
"Description": {
"Hostname": "swarm-manager",
"Platform": {
"Architecture": "x86_64",
"OS": "linux"
},
"Resources": {
"NanoCPUs": 1000000000,
"MemoryBytes": 1039843328
},
"Engine": {
"EngineVersion": "17.06.0-ce",
"Plugins": [
{
"Type": "Volume",
},
"Status": {
"State": "ready",
"Addr": "168.0.32.137"
},
"ManagerStatus": {
"Leader": true,
"Reachability": "reachable",
"Addr": "168.0.32.137:2377"
}
}
]</pre>
</div>
</div>
<div class="admonitionblock note">
<table>
<tr>
<td class="icon">
<i class="fa icon-note" title="Note"></i>
</td>
<td class="content">
<div class="title">INFO</div>
<div class="paragraph">
<p>Filtering output with jq</p>
</div>
<div class="listingblock">
<div class="title">jq</div>
<div class="content">
<pre class="CodeRay highlight"><code data-lang="sh">apt update
apt install jq
docker node inspect id | jq -r '.[][&quot;Status&quot;][&quot;State&quot;]'</code></pre>
</div>
</div>
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_deploy_services_and_tasks">5. Deploy services and Tasks</h2>
<div class="sectionbody">
<div class="paragraph">
<p>To deploy an application image when Docker Engine is in swarm mode, you <strong>create a service.</strong></p>
</div>
<div class="paragraph">
<p>A <strong>service</strong> is the image for a microservice within the context of some larger application.</p>
</div>
<div class="paragraph">
<p><code><em>Examples of services might include an HTTP server, a database, or any other type of executable program that you wish to run in a distributed environment.</em></code></p>
</div>
<div class="paragraph">
<p>A <strong>task</strong> is the atomic unit of scheduling within a swarm.</p>
</div>
<div class="paragraph">
<p>When you declare a desired service state by creating or updating a service, the orchestrator realizes the desired state by scheduling tasks.</p>
</div>
<div class="paragraph">
<p><code><em>For instance, you define a service that instructs the orchestrator to keep three instances of an HTTP listener running at all times.</em></code></p>
</div>
<div class="paragraph">
<p>The orchestrator responds by creating three tasks.</p>
</div>
<div class="paragraph">
<p>Each task is a slot that the scheduler fills by spawning a container.</p>
</div>
<div class="paragraph">
<p><span class="image"><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAyAAAAIoCAIAAAAeNhjmAAFTNElEQVR4AezZA3BjaQAH8O+9FxzHcx7jRje2b6x1sfbWbsy1bdtbz8ZrG7VjTprUSJq84pi1lf9v+PjZhAV4pwAAAIA8dQcAAAAAMMECAAAAwAQLAAAAABMsAAAAAMAECwAAAAATLAAAiIb7a6pqbt6vuVtnG4yy8MXw2C2371ddf1Dv6+hnIQ7Q5JkAACAyYNJrr1Q7yQfUG7TnFqomZUoWLD3ZO0jgo7M3V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Te+z7XaEOiZ1buP8biOcQJRg4IzxnZrln6ZgXWPhVmRre6tLB09E+IvRDNxkF9b35bo+urcScgDHiWQHDv4Bj2dcD+o7q2wnqkLX0GuzXFSxVIUtVJqihyM88ezuHZiiZncucbz5zbiaql2LnOvurIc5izIjR1esXi3RCg7m/3rPP6L61K2Zla9eimRQI8hQhQRDEn05s47hixcLYLct+XDOro4O08cuu5ToTomkMgABBDZmVrQ0FSCTKTb765YKNP9+4W1CugloobEjEjC8jwvr3dLOTQl0IURQbHblvzv4zRlpEi1vOnT190sBu0BQV5D7OUbMU5t28u/l0dISG6C/HTz66Y9XxncvDfTvxWnlBQTFFI6aZfeDA9+AF6NCP/W0YRNN02v37SjOGX2GOo99/9w0aGnJzs6dpQABGM4Z/Jnj4yNjtKywlfTHwLWiIKy5RcIwYYQyAEPwrMMeLLFU1Huzu1pKinlUlQI3sjIf5Bg4EvkOXHj08bKER105v
</div>
<div class="sect2">
<h3 id="_service_vs_stack">5.1. service vs stack</h3>
<div class="ulist">
<ul>
<li>
<p>A <strong>Service</strong> defines one or more instances of a single image deployed on one or more machines (described by one entry in the services part of <strong>yaml</strong> files).</p>
</li>
<li>
<p>A <strong>Stack</strong> defines a group of heterogeneous services (described by the whole yaml file).</p>
</li>
</ul>
</div>
<div class="paragraph">
<p>The <strong>docker service</strong> command is used when managing individual service on a docker swarm cluster.</p>
</div>
<div class="paragraph">
<p>The <strong>docker stack</strong> command can be used to manage a multi-service application.</p>
</div>
</div>
<div class="sect2">
<h3 id="_build">5.2. Build</h3>
<div class="admonitionblock note">
<table>
<tr>
<td class="icon">
<i class="fa icon-note" title="Note"></i>
</td>
<td class="content">
<div class="title">INFO</div>
<div class="paragraph">
<p>This is a cluster management command, and must be executed on a swarm manager node.</p>
</div>
</td>
</tr>
</table>
</div>
<div class="sect3">
<h4 id="_create_yaml">5.2.1. Create yaml</h4>
<div class="listingblock">
<div class="title">yml example MPI (save as run.yml)</div>
<div class="content">
<pre class="CodeRay highlight"><code data-lang="yaml"><span class="key">version</span>: <span class="string"><span class="delimiter">&quot;</span><span class="content">3.8</span><span class="delimiter">&quot;</span></span>
<span class="key">services</span>:
<span class="key">master</span>:
<span class="key">image</span>: <span class="string"><span class="content">image</span></span>
<span class="key">user</span>: <span class="string"><span class="content">root</span></span>
<span class="key">environment</span>:
<span class="comment"># Pass environment variables to containers CUSTOM</span>
- <span class="string"><span class="content">PASSWORD=dgergergergerrfgwehrtsger</span></span>
- <span class="string"><span class="content">PASSWORDVIEW=rtyrwtyrwftertgueteyserfy5e6ytrg</span></span>
- <span class="string"><span class="content">SERVERROLE=master</span></span>
- <span class="string"><span class="content">SERVERWEB=no</span></span>
<span class="comment"># Pass environment variables to containers FROM ENGINE see inspect</span>
- <span class="string"><span class="content">NODENAME={{.Node.Hostname}}</span></span>
- <span class="string"><span class="content">NODEID={{.Node.ID}}</span></span>
- <span class="string"><span class="content">SERVICEID={{.Service.ID}}</span></span>
- <span class="string"><span class="content">SERVICENAME={{.Service.Name}}</span></span>
- <span class="string"><span class="content">TASKID={{.Task.ID}}</span></span>
- <span class="string"><span class="content">TASKNAME={{.Task.Name}}</span></span>
- <span class="string"><span class="content">TASKREPID={{.Task.Slot}}</span></span>
<span class="key">deploy</span>:
<span class="comment"># mode: global # see image replica-vs-global</span>
<span class="key">replicas</span>: <span class="string"><span class="content">1</span></span>
<span class="key">placement</span>:
<span class="key">max_replicas_per_node</span>: <span class="string"><span class="content">1</span></span>
<span class="key">constraints</span>:
- <span class="string"><span class="content">node.role == worker</span></span>
<span class="comment">#- node.labels.region == region1</span>
<span class="key">resources</span>:
<span class="key">limits</span>:
<span class="key">cpus</span>: <span class="string"><span class="content">'0.50'</span></span>
<span class="key">memory</span>: <span class="string"><span class="content">500M</span></span>
<span class="key">reservations</span>:
<span class="key">cpus</span>: <span class="string"><span class="content">'0.25'</span></span>
<span class="key">memory</span>: <span class="string"><span class="content">200M</span></span>
<span class="key">restart_policy</span>:
<span class="key">condition</span>: <span class="string"><span class="content">on-failure</span></span>
<span class="key">delay</span>: <span class="string"><span class="content">5s</span></span>
<span class="key">max_attempts</span>: <span class="string"><span class="content">5</span></span>
<span class="key">window</span>: <span class="string"><span class="content">120s</span></span>
<span class="key">update_config</span>:
<span class="key">parallelism</span>: <span class="string"><span class="content">2</span></span>
<span class="key">delay</span>: <span class="string"><span class="content">10s</span></span>
<span class="key">order</span>: <span class="string"><span class="content">stop-first</span></span>
<span class="key">networks</span>:
<span class="key">mpi2-net</span>:
<span class="key">ports</span>:
- <span class="string"><span class="delimiter">&quot;</span><span class="content">5580:80</span><span class="delimiter">&quot;</span></span>
- <span class="string"><span class="delimiter">&quot;</span><span class="content">5588:8088</span><span class="delimiter">&quot;</span></span>
<span class="key">slave</span>:
<span class="key">image</span>: <span class="string"><span class="content">image</span></span>
<span class="key">user</span>: <span class="string"><span class="content">root</span></span>
<span class="key">environment</span>:
- <span class="string"><span class="content">PASSWORD=rtyrthrthyrthyrtyrtyrty</span></span>
- <span class="string"><span class="content">PASSWORDVIEW=rtyrtuyrtuyrt</span></span>
- <span class="string"><span class="content">SERVERROLE=slave</span></span>
- <span class="string"><span class="content">SERVERWEB=no</span></span>
- <span class="string"><span class="content">NODENAME={{.Node.Hostname}}</span></span>
- <span class="string"><span class="content">NODEID={{.Node.ID}}</span></span>
- <span class="string"><span class="content">SERVICEID={{.Service.ID}}</span></span>
- <span class="string"><span class="content">SERVICENAME={{.Service.Name}}</span></span>
- <span class="string"><span class="content">TASKID={{.Task.ID}}</span></span>
- <span class="string"><span class="content">TASKNAME={{.Task.Name}}</span></span>
- <span class="string"><span class="content">TASKREPID={{.Task.Slot}}</span></span>
<span class="key">deploy</span>:
<span class="comment"># mode: global # see image replica-vs-global</span>
<span class="key">replicas</span>: <span class="string"><span class="content">9</span></span>
<span class="key">placement</span>:
<span class="key">max_replicas_per_node</span>: <span class="string"><span class="content">1</span></span>
<span class="key">constraints</span>:
- <span class="string"><span class="content">node.role == worker</span></span>
- <span class="string"><span class="content">node.labels.region == region2</span></span>
<span class="key">resources</span>:
<span class="key">limits</span>:
<span class="key">cpus</span>: <span class="string"><span class="content">'0.50'</span></span>
<span class="key">memory</span>: <span class="string"><span class="content">500M</span></span>
<span class="key">reservations</span>:
<span class="key">cpus</span>: <span class="string"><span class="content">'0.25'</span></span>
<span class="key">memory</span>: <span class="string"><span class="content">200M</span></span>
<span class="key">restart_policy</span>:
<span class="key">condition</span>: <span class="string"><span class="content">on-failure</span></span>
<span class="key">delay</span>: <span class="string"><span class="content">5s</span></span>
<span class="key">max_attempts</span>: <span class="string"><span class="content">5</span></span>
<span class="key">window</span>: <span class="string"><span class="content">120s</span></span>
<span class="key">update_config</span>:
<span class="key">parallelism</span>: <span class="string"><span class="content">2</span></span>
<span class="key">delay</span>: <span class="string"><span class="content">10s</span></span>
<span class="key">order</span>: <span class="string"><span class="content">stop-first</span></span>
<span class="key">networks</span>:
<span class="key">mpi2-net</span>:
<span class="key">ports</span>:
- <span class="string"><span class="delimiter">&quot;</span><span class="content">5581:80</span><span class="delimiter">&quot;</span></span>
- <span class="string"><span class="delimiter">&quot;</span><span class="content">5590:8088</span><span class="delimiter">&quot;</span></span>
<span class="key">web</span>:
<span class="key">image</span>: <span class="string"><span class="content">image</span></span>
<span class="key">user</span>: <span class="string"><span class="content">root</span></span>
<span class="key">environment</span>:
- <span class="string"><span class="content">SERVERROLE=web</span></span>
- <span class="string"><span class="content">SERVERWEB=yes</span></span>
- <span class="string"><span class="content">NODENAME={{.Node.Hostname}}</span></span>
- <span class="string"><span class="content">NODEID={{.Node.ID}}</span></span>
- <span class="string"><span class="content">SERVICEID={{.Service.ID}}</span></span>
- <span class="string"><span class="content">SERVICENAME={{.Service.Name}}</span></span>
- <span class="string"><span class="content">TASKID={{.Task.ID}}</span></span>
- <span class="string"><span class="content">TASKNAME={{.Task.Name}}</span></span>
- <span class="string"><span class="content">TASKREPID={{.Task.Slot}}</span></span>
<span class="key">deploy</span>:
<span class="comment"># mode: global # see image replica-vs-global</span>
<span class="key">replicas</span>: <span class="string"><span class="content">1</span></span>
<span class="key">placement</span>:
<span class="key">constraints</span>:
- <span class="string"><span class="content">node.role == worker</span></span>
- <span class="string"><span class="content">node.labels.region == region3</span></span>
<span class="key">resources</span>:
<span class="key">limits</span>:
<span class="key">cpus</span>: <span class="string"><span class="content">'0.50'</span></span>
<span class="key">memory</span>: <span class="string"><span class="content">500M</span></span>
<span class="key">reservations</span>:
<span class="key">cpus</span>: <span class="string"><span class="content">'0.25'</span></span>
<span class="key">memory</span>: <span class="string"><span class="content">200M</span></span>
<span class="key">restart_policy</span>:
<span class="key">condition</span>: <span class="string"><span class="content">on-failure</span></span>
<span class="key">delay</span>: <span class="string"><span class="content">5s</span></span>
<span class="key">max_attempts</span>: <span class="string"><span class="content">5</span></span>
<span class="key">window</span>: <span class="string"><span class="content">120s</span></span>
<span class="key">update_config</span>:
<span class="key">parallelism</span>: <span class="string"><span class="content">2</span></span>
<span class="key">delay</span>: <span class="string"><span class="content">10s</span></span>
<span class="key">order</span>: <span class="string"><span class="content">stop-first</span></span>
<span class="key">networks</span>:
<span class="key">mpi2-net</span>:
<span class="key">ports</span>:
- <span class="string"><span class="delimiter">&quot;</span><span class="content">5598:80</span><span class="delimiter">&quot;</span></span>
- <span class="string"><span class="delimiter">&quot;</span><span class="content">5599:8088</span><span class="delimiter">&quot;</span></span>
<span class="key">networks</span>:
<span class="key">mpi2-net</span>:</code></pre>
</div>
</div>
<div class="paragraph">
<div class="title">replicas-vs-global</div>
<p><span class="image"><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAA2QAAAJsCAIAAAAdrvdGAADGKklEQVR4AezWgQAAAAACoP2ln2CDoig9AABAFgEAkEUAAGQRAABZBABAFgEAkEUAAGQRAABZBABAFgEAkEUAAGQRAABkEQAAWQQAQBYBAJBFAABkEQAAWQQAQBYBAJBFAABkEQAAWQQAAFkEAEAWAQCQRQAAZBEAAFkEAEAWAQCQRQAAZBEAAFkEAEAWAQBAFgEAkEUAAGQR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lgsHDCqjqebmgvC6eLQMLAJV+HA927lwyBg6Q/6lS2GRXfulsCQAi427Q+4Il4OsXGzxALFM0riEBpO0ttawSP0peajKmHGmjAw+cja3bjnO6dsRaYW6Nh9hTNL0R5Vg/58yovU9d9FN+AhRTvARGFRz45Jy8fhlv3i6DCxixfXudg4sDl8gqu5SWGTm0HyfRvxcOGLwcqLZDXPhyBY2HLFD52QqTHVMubiujbPgVPNCI8+VCV6zcdJn2HBssRW5ts5vpNoafPyfsh6NOE7JgkV9NIPdx3XV8YMLOFg8XQYW1TnLDoLF80TVXQ2LnJjHaX6OgcVzwfFbTnk5AxYJvUGHBTXN+CiiRIi5srmLY07kX8jIyOinilyT1/h3vZ+YO7p94MfPX+Rfyyi7vN6CxYgMhwSdaLVowSJp3CJGJgzdu8NBYeizhKFdDYsEbQ/o6hZn1LjYExapDKUmlA7GuCCiBCkSYq5s6SJPS/5fGRkZffq6QGBaJz4yy2BHGqlQi637QoiW
</div>
<div class="admonitionblock note">
<table>
<tr>
<td class="icon">
<i class="fa icon-note" title="Note"></i>
</td>
<td class="content">
<div class="title">INFO</div>
<div class="paragraph">
<p>YAML (a recursive acronym for "YAML Ain&#8217;t Markup Language") is a human-readable data-serialization language.</p>
</div>
<div class="paragraph">
<p>It is commonly used for configuration files and in applications where data is being stored or transmitted.</p>
</div>
<div class="paragraph">
<p>YAML targets many of the same communications applications as Extensible Markup Language (XML) but has a minimal syntax which intentionally differs from SGML </p>
</div>
<div class="paragraph">
<p>It uses Python-style indentation to indicate nesting</p>
</div>
<div class="paragraph">
<p>From Wikipedia, the free encyclopedia<br></p>
</div>
<div class="paragraph">
<p>more: Learn YAML in five minutes!
<a href="https://www.codeproject.com/Articles/1214409/Learn-YAML-in-five-minutes" class="bare" target="_blank" rel="noopener">https://www.codeproject.com/Articles/1214409/Learn-YAML-in-five-minutes</a></p>
</div>
</td>
</tr>
</table>
</div>
</div>
<div class="sect3">
<h4 id="_build_2">5.2.2. Build</h4>
<div class="listingblock">
<div class="title">build</div>
<div class="content">
<pre class="CodeRay highlight"><code data-lang="sh">docker stack deploy -c run.yml my_service</code></pre>
</div>
</div>
</div>
<div class="sect3">
<h4 id="_list_services">5.2.3. List services</h4>
<div class="listingblock">
<div class="title">List the services that are running as part of the specified stack.</div>
<div class="content">
<pre class="CodeRay highlight"><code data-lang="sh">docker stack services</code></pre>
</div>
</div>
<div class="listingblock">
<div class="title">List <strong>ALL</strong> services are running in the swarm.</div>
<div class="content">
<pre class="CodeRay highlight"><code data-lang="sh">docker service ls</code></pre>
</div>
</div>
</div>
<div class="sect3">
<h4 id="_remove_one_or_more_stacks">5.2.4. Remove one or more stacks</h4>
<div class="listingblock">
<div class="title">Remove the stack from the swarm.</div>
<div class="content">
<pre class="CodeRay highlight"><code data-lang="sh">docker stack rm</code></pre>
</div>
</div>
<div class="listingblock">
<div class="title">Removes the specified services from the swarm.</div>
<div class="content">
<pre class="CodeRay highlight"><code data-lang="sh">docker service rm</code></pre>
</div>
</div>
</div>
<div class="sect3">
<h4 id="_list_tasks">5.2.5. List tasks</h4>
<div class="listingblock">
<div class="title">List the tasks that are running as part of the specified services.</div>
<div class="content">
<pre class="CodeRay highlight"><code data-lang="sh">docker service ps</code></pre>
</div>
</div>
<div class="listingblock">
<div class="title">List the tasks in the stack</div>
<div class="content">
<pre class="CodeRay highlight"><code data-lang="sh">docker stack ps</code></pre>
</div>
</div>
<div class="sidebarblock">
<div class="content">
<div class="title">INFO</div>
<div class="paragraph">
<p>Command-line completion (also tab completion) is a common feature of command-line interpreters, in which the program automatically fills in partially typed commands.</p>
</div>
<div class="paragraph">
<p>more info: <a href="https://en.wikipedia.org/wiki/Command-line_completion" class="bare" target="_blank" rel="noopener">https://en.wikipedia.org/wiki/Command-line_completion</a></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div id="footer">
<div id="footer-text">
Last updated 2021-04-05 18:26:52 UTC
</div>
</div>
<style>
/* Stylesheet for CodeRay to match GitHub theme | MIT License | http://foundation.zurb.com */
pre.CodeRay{background:#f7f7f8}
.CodeRay .line-numbers{border-right:1px solid currentColor;opacity:.35;padding:0 .5em 0 0}
.CodeRay span.line-numbers{display:inline-block;margin-right:.75em}
.CodeRay .line-numbers strong{color:#000}
table.CodeRay{border-collapse:separate;border:0;margin-bottom:0;background:none}
table.CodeRay td{vertical-align:top;line-height:inherit}
table.CodeRay td.line-numbers{text-align:right}
table.CodeRay td.code{padding:0 0 0 .75em}
.CodeRay .debug{color:#fff !important;background:#000080 !important}
.CodeRay .annotation{color:#007}
.CodeRay .attribute-name{color:#000080}
.CodeRay .attribute-value{color:#700}
.CodeRay .binary{color:#509}
.CodeRay .comment{color:#998;font-style:italic}
.CodeRay .char{color:#04d}
.CodeRay .char .content{color:#04d}
.CodeRay .char .delimiter{color:#039}
.CodeRay .class{color:#458;font-weight:bold}
.CodeRay .complex{color:#a08}
.CodeRay .constant,.CodeRay .predefined-constant{color:#008080}
.CodeRay .color{color:#099}
.CodeRay .class-variable{color:#369}
.CodeRay .decorator{color:#b0b}
.CodeRay .definition{color:#099}
.CodeRay .delimiter{color:#000}
.CodeRay .doc{color:#970}
.CodeRay .doctype{color:#34b}
.CodeRay .doc-string{color:#d42}
.CodeRay .escape{color:#666}
.CodeRay .entity{color:#800}
.CodeRay .error{color:#808}
.CodeRay .exception{color:inherit}
.CodeRay .filename{color:#099}
.CodeRay .function{color:#900;font-weight:bold}
.CodeRay .global-variable{color:#008080}
.CodeRay .hex{color:#058}
.CodeRay .integer,.CodeRay .float{color:#099}
.CodeRay .include{color:#555}
.CodeRay .inline{color:#000}
.CodeRay .inline .inline{background:#ccc}
.CodeRay .inline .inline .inline{background:#bbb}
.CodeRay .inline .inline-delimiter{color:#d14}
.CodeRay .inline-delimiter{color:#d14}
.CodeRay .important{color:#555;font-weight:bold}
.CodeRay .interpreted{color:#b2b}
.CodeRay .instance-variable{color:#008080}
.CodeRay .label{color:#970}
.CodeRay .local-variable{color:#963}
.CodeRay .octal{color:#40e}
.CodeRay .predefined{color:#369}
.CodeRay .preprocessor{color:#579}
.CodeRay .pseudo-class{color:#555}
.CodeRay .directive{font-weight:bold}
.CodeRay .type{font-weight:bold}
.CodeRay .predefined-type{color:inherit}
.CodeRay .reserved,.CodeRay .keyword {color:#000;font-weight:bold}
.CodeRay .key{color:#808}
.CodeRay .key .delimiter{color:#606}
.CodeRay .key .char{color:#80f}
.CodeRay .value{color:#088}
.CodeRay .regexp .delimiter{color:#808}
.CodeRay .regexp .content{color:#808}
.CodeRay .regexp .modifier{color:#808}
.CodeRay .regexp .char{color:#d14}
.CodeRay .regexp .function{color:#404;font-weight:bold}
.CodeRay .string{color:#d20}
.CodeRay .string .string .string{background:#ffd0d0}
.CodeRay .string .content{color:#d14}
.CodeRay .string .char{color:#d14}
.CodeRay .string .delimiter{color:#d14}
.CodeRay .shell{color:#d14}
.CodeRay .shell .delimiter{color:#d14}
.CodeRay .symbol{color:#990073}
.CodeRay .symbol .content{color:#a60}
.CodeRay .symbol .delimiter{color:#630}
.CodeRay .tag{color:#008080}
.CodeRay .tag-special{color:#d70}
.CodeRay .variable{color:#036}
.CodeRay .insert{background:#afa}
.CodeRay .delete{background:#faa}
.CodeRay .change{color:#aaf;background:#007}
.CodeRay .head{color:#f8f;background:#505}
.CodeRay .insert .insert{color:#080}
.CodeRay .delete .delete{color:#800}
.CodeRay .change .change{color:#66f}
.CodeRay .head .head{color:#f4f}
</style>
</body>
</html>