Since I last properly [wrote about Docker](/2014/08/31/docker-fig-nginx-reverse-proxies-and-centos-7/“Docker, Fig, NGINX Reverse Proxies and CentOS 7”) a lot has changed. Docker have introduced some new command line tools which allow for easy orchestration of Docker instances, clusters and container management. These are;

  • Docker Machine  — Allows you to easily deploy Docker instances to a lot of different platforms.
  • Docker Compose  — A replacement for Fig .
  • Docker Swarm  — Native clustering for your Docker instances.

Out of these three technologies, Swarm is not really suitable for production use so I won’t go into it in too much detail in this post.

Docker Machine

Rather than downloading the pre-compiled binary I decided to use the Homebrew formula (this assumes you have Cask installed);

Docker Machine, Compose & Swarm 1/39
#bbbb#brrrrrMeeeeieawwwwnwkseudcctcpoaaaasdcsslsuatkklkrtoeeruddipoonedccsvatktetoearerrly-ltmhadiconhcgikneiers-muapc-htion-edate

This will install docker-machine;

Docker Machine, Compose & Swarm 2/39
dddNoooAcccMkkkEeeerrrA---CmmmTaaaIcccVhhhEiiinnnDeeeRIvlVesErRsiSoTnAT0E.1U.R0LSWARM

I already have VirtualBox installed so lets create a machine called “Testing”;

Docker Machine, Compose & Swarm 3/39
dIIIIIIoNNNNNNcFFFFFFkOOOOOOe[[[[[[r000000-000000m000033a006688c]]]]]]hiCCSWTnrrtatoeeeaieaartspctttitoriiiniiennngnnaggggttfeSVVoySiirhoHrrauttVsrdkuuMreaabDiyllteovBBoeceoonkrxxsetcrvVVariMMrecrtalttiueeadnltbaonaxdttiiests,tniornwugnthtehiasctiinveyomuarchsihneel.l:$(docker-machineenvtesting)

docker-machine comes with a few commands which will help you connect using the locally installed docker client;

Docker Machine, Compose & Swarm 4/39
deeedoxxxocpppctkoooklerrresrtttr--mDDDmaOOOatcCCCclhKKKhsiEEEicnRRRnae___ecTCHeeLEOcrnSRSotv_TTn=V_=f/tEPtiUeRAcgssITpetFH:triY=esn=/s/gyU1tres9iuse2nsr.gss1//6.r8du.os9cs9k/.e.1rd0/o0mc:ak2ce3hr7i/6nmea/cmhaicnhei/nmeasc/htiensetsi/ntge/sctai.npgemtlscert=/Users/russ/.docker/machine/machines/testing/cert.pemtlskey=/Users/russ/.docker/machine/machines/testing/key.pem-H=tcp://192.168.99.100:2376

Thats it, I now have a Virtual Machine launched and ready for me to start using Docker;

Docker Machine, Compose & Swarm 5/39
dNtoAecMskEteirAn-CgmTaIcVhEviinDreRtIulVasElRboSxTARTuEnnUiRnLgStWcApR:M//192.168.99.100:2376

As with any new installation, lets run a “Hello World” ;

Docker Machine, Compose & Swarm 6/39
SdU5de4bthon1fa9uaeca1718stlkb1536yulel341bbsore664fo:ef98xw$ta99c:Do(o3f41lordc055awlof56c3tndcia0b6elkn::::soedtarPPPP:d-iuuuuemmllllTdaallllhcgenhecccceiooooiwnmmmmmeebpppparullllgcseeeeeioyttttmnbeeeeyafoogixueg:laftaroetersetspbituunlsgly)libonorcgxua:nlhllaabystuesbsyetbeonxveecrhiofiheedl.loImwpoorrltdant:imageverificationisatechpreviewfeatureandshouldnotbereliedontoprovidesecurity.

Finally you can SSH to the Virtual Machine using docker-machine ssh machine-name;

Docker Machine, Compose & Swarm 7/39
dBDdLdNVIIVPAHSBdooooioAEDDERNOUUococcncMR=_RESMPGcktkkukESbLSTIEP_ke2eexe=IoIIT__ORerDrrrBOoKOYCUREr-o@t@oNtEN_ORTP@mcvteto=2=_NLL_Otakeeset1dtIAO=URecersts2.ocDMRRTshrstitD5cl=E=hL_tiiinio.k1=t=Uinvongnc0e.1tRneenggkr5B;phLgr:3:e.o3:t=:ss1~.~r0o4/t$si.$1$t"/phho582bsten.u.cDo:txt0n5aoo/pie1,a-tct/sts.mtk2g:t5bei/edi/i.unerot/n0i-ytchgg,lacc1kuido/.ebtbr*5r.huaer..cui86e0iobla4lom.d3e("c1#aTbome1sComafeLo/sStbtM52oeP.dor4otS)c2:u;kdneoamrc6Fa/k6esbebbtorceo/e1rtb52o0:do6ot:ac2T06kdu26eoe:brc3c"kF0eee5rbU/Ti1Cs0Ts2uu20ee31s:5F"3e1xb:82617_06U42T3CG:N32U10/:1L25i7nuUxTC2015"

Great, so I now have a Virtual Machine running on my local computer, what more is there?

docker-machine is designed to be used with the following public and private cloud providers (more are being added all of the time);

  • Amazon EC2
  • Microsoft Azure
  • Digital Ocean
  • Google Compute Engine
  • Rackspace
  • SoftLayer
  • OpenStack
  • VMWare vCloud Air
  • VMWare vSphere

Lets use docker-machine to launch aDigital Oceandroplet. To do this you will need to generate a Personal Access Token, you can do this byfollowing these instructions. Once have the token launch the droplet as follows;

Docker Machine, Compose & Swarm 8/39
dIIIIIIoNNNNNNcdFFFFFFkoOOOOOOeddt[[[[[[rrie000000-igs000011mvit000722aeti004100cran]]]]]]hlgidoCCWCTnicrraodoegeeeinoiaaatftpctnttiieora-iingsielanngutnaocggrittccfineeeSDongyasSirgo\nsHgu-iSMhrtktSaaeaHcsDkylhoeibcnOnekceeecenrdabncc8rl1deieraedotn0pet5ld7ea5tatbn5diat8i,ds3r7nuconewat0thdhi0es6cai9cn6t9iy0vodeuaram0as7ch4hebil1nl2e:7.6$8(9d2ofcck8e4r7-3mbadcdhai9n7eebe7ncv65daoete\sting)

(and no, that is not my Digital Ocean Personal Access Token, it’s just a random string)

So what just happened? docker-machine accessed my Digital Ocean account via the API and launched the following Droplet;

  • OS = Ubuntu 14.04 x64
  • RAM = 512MB
  • HDD = 20GB SSD
  • Region = NYC3

These defaults can be over-ridden by providing more options, run docker-machine create — help for a full break down of the options along with example arguments.

Once the droplet had finished booting, docker-machine connected to the droplet via SSH installed, configured and started the latest version of Docker.

So, we now have two machines launched, one locally and one in Digital Ocean;

Docker Machine, Compose & Swarm 9/39
dNdtoAoecMtskEetesirAtn-CigmTnaIgvcVihEritnDdueRiaIgllVibsEtoRaxlSoRTcuAenTanEninURgRuLntncSipWn:Ag/R/Mt1c9p2:.1/6485..9595..110304:.2234786:2376

lets run the “hello world” again, but this time use the droplet which has just been launched;

Docker Machine, Compose & Swarm 10/39
SdU5de4bthon1fa9uaeca1718stlkb1536yulel341bbsore664fo:ef98xw$ta99c:Do(o3f41lordc055awlof56c3tndcia0b6elkn::::soedtarPPPP:d-iuuuuemmllllTdaallllhcgenhecccceiooooiwnmmmmmeebpppparullllgcseeeeeioyttttmnbeeeeyafoogixueg:lafdarooterteespbstuutlsilynlibgono)cgxa:rlhlulaanystebbsuetseynbovxereicfhioedh.elIlmopowrotralndt:imageverificationisatechpreviewfeatureandshouldnotbereliedontoprovidesecurity.

and finally SSH into the machine;

Docker Machine, Compose & Swarm 11/39
DSSGrdWoyyUMSrhoRbrCbrloecsssewatoEuoO8oocluttamapttPsoNaogkcmeegophp@OytT8toeoemmersdSb@A3@urmnyut:oIodI0dt-etilosh/tTxoN7omanofuai/eOtE7tattfasgslsRleRdecoiod/aeatYas8shor::g:dnittI5tiUnmeadnTeiD8inb:a01:0tsgAsnneut.1%ac:GtgIbgnhi4.1a~:Mu:stto342Iap#I4~As~sutn%%PneM9#Gy#hpPd.dA8Eb1saroIacoG6doed4:sofPdmacEboCxxo./cdankfcO:it0/oe1arnoeI8kMlte4hfs9deanrDceMas.es.dsgi1rAtt1lSe5rseciC5Neipas6eamR3pDsnL.t:GsftlaE6stgTuBsoh.gACSbM7riceT1-Rua2UfsosE1aEe(nrsodmDAcGteros/wThNu2rcyVeEoU.1seksIeD/ctetRkhLo0lhreTsSeim7o00mUTln/:g::AaAlu2gaLgTox4e41toU:d57:SSw30.2I2o.2i5.Z.Pr1n51E4Ol3E:.73Rd.D1.3T0T034S42M442..BN3021Am-14Mig58EneSunteersicagxo86E_x6i4t)ed(0)4minutesagokickass_almeida

Finally, you can stop and remove machines using docker-machine stop machine-name and docker-machine rm machine-name, be careful when using rm as it does not prompt you if you are sure;

Docker Machine, Compose & Swarm 12/39
dNdtddNdtddNtoAoeooAoeooAecMtsccMtsccMskEetkkEetkkEtesieesieeirAtnrrAtnrrAn-Cig--Cig--CgmTnmmTnmmTaIgvaaIgvaaIvcViccViccVihErhhErhhEritiitiitnDdunnDdunnDueRiaeeRiaeeRaIglIglIllVibslVibrlVbsEtotsEtomsEoRaxoRaxRxlpldSoRSoRoSRTcudTcutTuAenoAeneAnTantTansTnEnieEnitEinsninURgtUSgnUgRuiRtgRLntnLotLtncgpccSipSppSpWn:We:W:Ag/Ad/A/R/R/R/Mt1Mt1M1c9c99p2p22:.:..111/6/66484885.5...9.99595995.5...1.1110100303004:4::.2.22232334747786866::22337766

So thats a quick overview of docker-machine. As you can see, it is a a really convenient way to bootstrap Docker server instances across many different providers and tear them down all using a single command from your local machine.

Docker Compose

Docker Compose started life as Fig which is something [I have written about before in a previous post](/2014/08/31/docker-fig-nginx-reverse-proxies-and-centos-7/“Docker, Fig, NGINX Reverse Proxies and CentOS 7”), the currently release doesn’t add too much in the way of new functionality, but it does start laying the foundations for working with docker-swam,click herefor the full release notes.

Like docker-machine I installed it using aHomebrewformula;

Docker Machine, Compose & Swarm 13/39
b=#==B/=/r=#==au=ue>#>>ss>sw#hrrD#PC/S/io#oaclulnw#uvoomosn#remcmctl#iapaaaao#ntllrlla#gse/y/ld#teCi#fitedn#ioclog#gn/lc#-bakh#1haret#.as/rt#1shf-p#._ics#0bcgo:#.eo/m/#yem1p#onp.h#sl1so#eie.em#mnt0e#isi:b#ttor#ean1e#.l.8w#bld6.#oeb#tdfi#tin#ltlt#eoer#.:sa#1,y#..#t2c#a.o#r2m#.M/#gb#zo#t#t#l#e#s#/#f#i#g#-#1#.#1#.#0#.#y#o#s#em1i0t0e..0b%ottle.1.tar.gz

So using docker-machine lets create a Docker server instance to use docker-compose with;

Docker Machine, Compose & Swarm 14/39
dIIIIIIoNNNNNNcFFFFFFkOOOOOOe[[[[[[r000000-000000m000044a117811c]]]]]]hiCCSWTnrrtacoeeeaioaartmpctttiporiiinoiennngsnagggettfeSVVoySiirhoHrrauttVsrdkuuMreaabDiyllteovBBoeceoonkrxxsetcrvVVariMMrecrtalttiueeadnltbaonaxdtciiostm,pnoorswuenthtehiasctiinveyomuarchsihneel.l:$(docker-machineenvcompose)

as docker-compose doesn’t interact directly with docker-machine we need to tell the main docker client the details of the server instance which has just been launched;

Docker Machine, Compose & Swarm 15/39
$(docker-machineenvcompose)

this command injects the environment variables needed for the docker client to connect to the server instance, to see these you can just run docker-machine env machine-name on it’s own;

Docker Machine, Compose & Swarm 16/39
deeeoxxxcpppkoooerrrrttt-mDDDaOOOcCCChKKKiEEEnRRRe___TCHeLEOnSRSv_TTV_=cEPtoRAcmITppFH:oY=s=/eyU1es9se2r.s1/6r8u.s9s9/..1d0o0c:k2e3r7/6machine/machines/compose

From here, it is just like Fig, apart from fig.yml file should now be called docker-compose.yml, I had a fig.yml file from a previous post still on my machine;

Docker Machine, Compose & Swarm 17/39
wdecpePlbcppeMMMMbooonHi:oornYYYY:vlr8vPndvr3ivSSSSeiu/t0i_kbeit3viQQQQrmmws:rPs:rms0irLLLL:aee:8oO:d:a:6lo____gsb0nObgenRDUPe::mLegmOASA:/e::eeOTESvndnTARSratmr:t_B:Wur:yu:PAOs/wstASwRswesrSEiDmwbmuS:b:cwsceWbk/ikOwlwehteRieintenDbbdmd:bbrlrlli/iweeccikkb//bnmlgaeirnixa-dpbhp

It launches two containers and links them together along with mounting the ./web folder in the NGINX container. The directory structure of the folder I am going to be running docker-compose from looks like;

Docker Machine, Compose & Swarm 18/39
1trdeier\\\e-[[[carrrtuuuosssrsssy,316507262]]]fiidwnloedecbeskxe.rp-hcpompose.yml

To start with I pulled the images which are going to be launched, you can ignore this part, it just makes showing whats going on in this post more straight forward;

Docker Machine, Compose & Swarm 19/39
dPPouucllklleiirnn-ggcodwmbepbo(sr(eursupssumslcmlkceknednrdircikc/km/anrgiiandxb-:plhapt:elsatt)est)

Now the images have been pulled down it’s time to launch the containers;

Docker Machine, Compose & Swarm 20/39
dCCorrceekaaettrii-nncggomeepxxoaasmmeppllueep__dw-bed_b1_1

We now have two running containers;

Docker Machine, Compose & Swarm 21/39
dNeeoaxxcmaakemmepprCll-oeecm__omdwmabepn_bod1_s1eS/tu/pasustrse/rlPlocoractlas/lb/ibni/nr/urnunUpUp0.00..00..00.:04:98105-4>-8>03/3t0c6p/tcp

You can also open your browser using;

Docker Machine, Compose & Swarm 22/39
openhttp://$(docker-machineip)

In my example I see aphpinfo()page.

phpinfo

Once the containers are running you can connect to them using docker exec;

Docker Machine, Compose & Swarm 23/39
d[Urrrnwwwwwrpprrr[eorSooogeeeeeoooooorxcoEoooibbbbbossooooikoRtttnsssssttttttotetxeeeeefftr@P111rrrrr9ii222@9I671vvvvv5xx3559e9D08+++++4019x7.000927eb%2..012222.70210bcbC00.9012300...beP100300e-6U.30000000.06ib5..0......0.010bt5%22.0000040...5cM150212ce8E131100009.08x0M5811.....16.1110a22015888856119m/V080049707/p]S071433333019405]l#Z6678888871816#e12322224162_pR5321888872422ewsS33053777744912xeS66952666606611iba026656862t_uT4818888?0211xT??6888883?6?Y??24445S2bSS88882s?S?RaSsSsS4?+sT????1S1ShA1111?3S41T3333SSSS:1:14::::S53104:S555511119:47:0T9999133335:07A3::::09007R0000:5555:5:0T::::599990000:000090:00:0T100000000:00I0::::/00b0M/pnn:0000u0apEuhgg00000sqsnsspii0rmphgCr-nnpppp/giiaO/fxxphhhhlrcnuMbp::hppppikxxMimp----b-uAn:mw-ffffelpN/aofppppxDpmsrpmmmme--yatkm::::ctltsee:/htrrpppppu-oepooooontnrppooooosirrolllltxu/poolfnurccmmmmi-isoeemyyyyxuxrcssywwww//essweeeem-bsebbbbauisnbsssssngsiiiit/iittttes/nteeeeruexept-ecwr/pihspo-rfdpm-.nconf)

Finally you can stop and remove the containers, and the Docker instance;

Docker Machine, Compose & Swarm 24/39
dSSGRRddNottoeeooAcooimmccMkppnookkEeppgvveeriiiirrA-nntnn--CcggoggmmToaaImeereeccVpxxexxhhEoaamaaiismmommnnDeppvppeeRllellIseeeerlVt__e__msEowdxdwRpebabecb_m_boS&_1p1_mT&1l1pAeoTd_sEoweceUkbRe_Lr1-,ScWoeAmxRpaMomspeler_mdb_1force

Docker Swarm

Before going any further, the documentation warns ….

Note: Swarm is currently in beta, so things are likely to change. We don’t recommend you use it in production yet.

Now that’s out of the way lets useHomebrewto install docker-swarm;

Docker Machine, Compose & Swarm 25/39
br=#=/e=#=uw>#>s#riD#Pno#lsw#uotn#rcal#ialo#nlla#g/d#Cdi#deon#olcg#clk#kaeh#errt#r/-t#-dsp#sows#wca:#akr/#rem/#mrh#--o#0sm#.we#1ab#.rr#0me#./w#y0.#o.b#s1i#e.n#m0t#i:r#ta#e4y#..#bfc#oio#tlm#te/#lsb#e,o#.t#t8t#a.l#r7e#.Ms#g/#zd#o#c#k#e#r#-#s#w#a#r#m#-#0.110.00..0y%osemite.bottle.tar.gz

As we already have docker-machine installed I will be using it to locally create the cluster, first of all we need to launch an instance and run the swarm container;

Docker Machine, Compose & Swarm 26/39
SdNdIIIIII$dU5aff936bst6oAoNNNNNN(on1e4f732fwa3cMcFFFFFFdca119fcf88atekEkOOOOOOokb1107896bru7ee[[[[[[cel3583fd06msarAr000000kre627761d9::1-C-000000ee458ee72lamTm000033rrta11798a3aDdaIa116699-uo3d4b10c8tobcVc]]]]]]mnc75d28c5ew6hEhaf5839dc81sn0iiCCSWTcsiaa7f7f7dtl7nDnrrtalohwn:::::::::oceReeeaioiadaeIaartcpnrPPPPPPPPTd4lVctttiaoemiuuuuuuuuhedsEriiinlimlllllllledbRennngnecallllllll0agggtnrgin5Stfhveeccccccccme6TeSVVoayaooooooooawaASiirsoltmmmmmmmmge2T-Hrruoespppppppper9EdttVbrcwllllllllbkuuMeaaeeeeeeeeyi1UveaaeDlrttttttttomfRiylltno)meeeeeeeeua5LrBBoc:gdtoocklae3Suxxsrear0WatertefcAlVVaaeofRbMMrtcsprMoteltuxdilselwlanliaontonrcdcgmaaa:litlhlslaaiystnteo,bswetretunhnevteahrciitsfiivieend.myaoIcumhrpionsreht.ealnlt::$i(mdaogcekevre-rmiafcihcianteioennvisloacatle)chpreviewfeatureandshouldnotbereliedontoprovidesecurity.

As you can see, I got a token when the container launched 63e7a1adb607ce4db056a29b1f5d30cf I will need this to add more nodes, but first we will need to create a Swarm master;

Docker Machine, Compose & Swarm 27/39
doIIIIIIIcNNNNNNNk-sFFFFFFFedwOOOOOOOrsssa[[[[[[[-vwwwr0000000miaaam0000000arrrr-0000344ctmmmm0066833hu--a]]]]]]]ia\mdsnlaitCCSWCTebsserrtaosootcreeainwcxeoaartfaprrvtttiiroe\eiiingmia\rnnngu-ntygggrmtefiatSVVonsy\oSiirgtokHrreuettVSrrnkuuMw:eaaaD/ylltrho/BBomac6oosk3xxseetbr7VVaeaMMrec1tnlaidcebrn6et0a7taceted4idatbn,0d5r6iuasn29ntboh1wifs5tdhi3en0cayfcotu\irveshmealclh:in$e(.docker-machineenvswarm-master)

We then need to connect the Docker client to the swarm, this is done by adding — swarm to the $(docker-machine env machine-name) command;

Docker Machine, Compose & Swarm 28/39
$(docker-machineenvswarmswarm-master)

Now lets add another node;

Docker Machine, Compose & Swarm 29/39
dIIIIIIoNNNNNNc-sFFFFFFkdwOOOOOOessa[[[[[[rvwwr000000-iaam000000mrrr-000034atmmn006698cu-o]]]]]]ha\ddilieCCSWCnbs-rrtaoseoc0eeainwxo0aartfacvtttiirr\eiiingmernnngu-aygggrntfioetSVVondoSiirge\kHrr-ettVS0nkuuMw0:eaaa/ylltr/BBomh6ooa3xxsset7VVabaMMre1teandbc6r0e7actee4ddba0n5d6ai2s9bn1ofw5dt3h0ecfac\tivemachine.

We now have a 2 node cluster called “swarm-master”;

Docker Machine, Compose & Swarm 30/39
dNlssoAowwcMcaakEarrelmmrA---CvmnmTiaoaIrsdcVttehEue-iar0nDl0eRbvIoilVxrsEtvRRuiuarSnltTnbuAioaTnxlEgbRoUtuxRcnLpnR:iuS/nnW/gnA1iR9tnM2cg.p1:t6/c8p.1:99/92..111906208.:.12963987..619091.:120327:623s7w6arsmw-amrams-tmearst(emraster)

Using docker info gives more information about the cluster;

Docker Machine, Compose & Swarm 31/39
dCNssooowwcndaCRRaCRRkteroeeroeeeasmnssmnssri:-tee-teenmarrnarrie2aivvoivvnrsneedneefsteddeeddo:er-rrsCM0sCM3::Pe0:PeUm:Um12so1so9:r1:r2y9y.0:20:1.6/01/086.4B84B9.99/.919.909191909:.2.29:9327M3M6i7iB6B

Great, so what does all of this mean?

Lets pull some images down;

Docker Machine, Compose & Swarm 32/39
ddoocckkeerr--HH119922..116688..9999..110012::22337766ppuullllrmeydsiqsl

Notice how I have pulled redis on “swarm-master” and mysql on “swarm-node-00”, I can now make sure that containers only launch on a node where the image is available;

Docker Machine, Compose & Swarm 33/39
dad7dC7aofo0oO0fc6cbcNb6k6k2kT26e1edeAd1r4r9rI9483N38rbrdpEdbubu6sR6bnbnffbc8I8c-8-3D38dddacaImrd9Mye79Asdn9nfGqia9a5Elsmdma::e8edCll24Oaar4meMtte4ybMeed8seAssidq5Nttsfl0D1d31-7C//-3eeReee32Ennba2Atta9f8Trrf6faEyyf8i4Dppidn9oon3i1Siii4taTnntey4Attyb:bT..:7i5Ussi0m7Shhm6a0a6g6Pmrgae0Oyee3=9Rsd=5=8Tqi=3m4Sr1y032e0sfNd8q3AsmiblfMeisf4Ecn9-bSour0eente99dedeM7ssiaY8s3S0aa3Qcgg2L3oo4_3aR5UU5O8pp8O7TL2_ePsmAsiSnStuWhtOaeRnsD=a6m3ys7se9ecctrncedptp3sa3ws0as6rw/mot-rcmdpas-stdwearmr/ymrs-eqndloidse1-00/mysql

another example would be ports being used on a node, lets pull my NGINX & PHP image on both nodes;

Docker Machine, Compose & Swarm 34/39
ddoocckkeerr--HH119922..116688..9999..110012::22337766ppuullllrruussssmmcckkeennddrriicckk//nnggiinnxx--pphhpp

Now lets launch the a container and bind it to port 80;

Docker Machine, Compose & Swarm 35/39
d2odc0k6e6rb2rcucnf2-8dd2-ap1f8a09:e8d0adr8uascs7mbc0k6e5n2d6r6ifc2k9/encgbi4n9xa-8p7h5p3b972780051ff83587

and again;

Docker Machine, Compose & Swarm 36/39
d4o0cfk5efreer2u5n7b-bd25-4p6a8603:98a05drcu5scs2mdc3k0efn8dfrai0cakc/1n6g9i1n4x5-ep4h3p1c534f85d8db51357f

Nothing special there you say? Well, normally, when trying to launch the second container you would have gotten the following error as you can not bind two containers to the same port;

Docker Machine, Compose & Swarm 37/39
dFoAcTkAe[r00r0u0n]-Edrr-opr8r0e:s8p0onrsuessfmrcokmenddareimcokn/:nguinnaxb-lpehptofindanodewithport80available

However, in this case as Docker is aware of what is running on the nodes wothin the cluster including which ports are in use. Docker via Swarm simply launched the container on “swarm-node-00” and it knew that port 80 was already in use on “swarm-master”;

Docker Machine, Compose & Swarm 38/39
dC427aoO0d0fcNf0b6kT5626eAf6d1rIeb94Ne238pE2cdbsR5c6b7ffbIb28cDb838IrrmrMuuyeAsssdGssqiEmmlscc::CkkllOeeaaMnnttMddeeArrssNiittDcckkC////RnneeEggnnAiittTnnrrExxyyD--ppppooShhiiTppnnA::ttTll..UaassStthheePssmrOttyeRsdTqiS//uu22Nss69ArrM//mmElliiSoonnccuuaattllee//ssbbiiaanngg//oorruuUUnnpp224869ssmmeeiiccnnoouunnttddeessssaa36gg33oo0769UU//ppttccLLppeesssssswwaattrrhhmmaa--nnnmoaaadsetss-eee0rcc0oornnmeddydsi11qs99l122..116688..9999..110012::8800-->>8800//ttccppsswwaarrmm--mnaosdtee-r0/0e/ldartuendk__emienssttoerifn

All of this was done with no prompting or special commands, it helpfully just got on with it

As you can see, docker-swarm is still very much in-development and there are some deal breakers, like containers not being able to talk to each other across nodes. However, with the news thatsocketplane.io(they produce a container based software defined networking solution using Open vSwitch) isjoining DockerI don’t think it will be too long before this problem is resolved.

Finally, lets remove the running instances;

Docker Machine, Compose & Swarm 39/39
docker-machinermlocalswarm-masterswarm-node-00

That’s it for now, expect a follow up post in the next few months as these tools are updated.