[{"data":1,"prerenderedAt":421},["ShallowReactive",2],{"i-mdi:theme-light-dark":3,"i-mdi:menu":8,"i-mdi:linkedin":10,"i-mdi:github":12,"i-mdi:email-outline":14,"article-\u002Farticles\u002Fstart-with-docker-1-from-development-to-release-in-seconds":16,"i-mdi:arrow-left":419},{"left":4,"top":4,"width":5,"height":5,"rotate":4,"vFlip":6,"hFlip":6,"body":7},0,24,false,"\u003Cpath fill=\"currentColor\" d=\"M7.5 2c-1.79 1.15-3 3.18-3 5.5s1.21 4.35 3.03 5.5C4.46 13 2 10.54 2 7.5A5.5 5.5 0 0 1 7.5 2m11.57 1.5l1.43 1.43L4.93 20.5L3.5 19.07zm-6.18 2.43L11.41 5L9.97 6l.42-1.7L9 3.24l1.75-.12l.58-1.65L12 3.1l1.73.03l-1.35 1.13zm-3.3 3.61l-1.16-.73l-1.12.78l.34-1.32l-1.09-.83l1.36-.09l.45-1.29l.51 1.27l1.36.03l-1.05.87zM19 13.5a5.5 5.5 0 0 1-5.5 5.5c-1.22 0-2.35-.4-3.26-1.07l7.69-7.69c.67.91 1.07 2.04 1.07 3.26m-4.4 6.58l2.77-1.15l-.24 3.35zm4.33-2.7l1.15-2.77l2.2 2.54zm1.15-4.96l-1.14-2.78l3.34.24zM9.63 18.93l2.77 1.15l-2.53 2.19z\"\u002F>",{"left":4,"top":4,"width":5,"height":5,"rotate":4,"vFlip":6,"hFlip":6,"body":9},"\u003Cpath fill=\"currentColor\" d=\"M3 6h18v2H3zm0 5h18v2H3zm0 5h18v2H3z\"\u002F>",{"left":4,"top":4,"width":5,"height":5,"rotate":4,"vFlip":6,"hFlip":6,"body":11},"\u003Cpath fill=\"currentColor\" d=\"M19 3a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2zm-.5 15.5v-5.3a3.26 3.26 0 0 0-3.26-3.26c-.85 0-1.84.52-2.32 1.3v-1.11h-2.79v8.37h2.79v-4.93c0-.77.62-1.4 1.39-1.4a1.4 1.4 0 0 1 1.4 1.4v4.93zM6.88 8.56a1.68 1.68 0 0 0 1.68-1.68c0-.93-.75-1.69-1.68-1.69a1.69 1.69 0 0 0-1.69 1.69c0 .93.76 1.68 1.69 1.68m1.39 9.94v-8.37H5.5v8.37z\"\u002F>",{"left":4,"top":4,"width":5,"height":5,"rotate":4,"vFlip":6,"hFlip":6,"body":13},"\u003Cpath fill=\"currentColor\" d=\"M12 2A10 10 0 0 0 2 12c0 4.42 2.87 8.17 6.84 9.5c.5.08.66-.23.66-.5v-1.69c-2.77.6-3.36-1.34-3.36-1.34c-.46-1.16-1.11-1.47-1.11-1.47c-.91-.62.07-.6.07-.6c1 .07 1.53 1.03 1.53 1.03c.87 1.52 2.34 1.07 2.91.83c.09-.65.35-1.09.63-1.34c-2.22-.25-4.55-1.11-4.55-4.92c0-1.11.38-2 1.03-2.71c-.1-.25-.45-1.29.1-2.64c0 0 .84-.27 2.75 1.02c.79-.22 1.65-.33 2.5-.33s1.71.11 2.5.33c1.91-1.29 2.75-1.02 2.75-1.02c.55 1.35.2 2.39.1 2.64c.65.71 1.03 1.6 1.03 2.71c0 3.82-2.34 4.66-4.57 4.91c.36.31.69.92.69 1.85V21c0 .27.16.59.67.5C19.14 20.16 22 16.42 22 12A10 10 0 0 0 12 2\"\u002F>",{"left":4,"top":4,"width":5,"height":5,"rotate":4,"vFlip":6,"hFlip":6,"body":15},"\u003Cpath fill=\"currentColor\" d=\"M22 6c0-1.1-.9-2-2-2H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2zm-2 0l-8 5l-8-5zm0 12H4V8l8 5l8-5z\"\u002F>",{"id":17,"title":18,"body":19,"category":33,"description":406,"extension":407,"meta":408,"navigation":409,"path":410,"published":411,"seo":412,"stem":413,"tags":414,"__hash__":418},"articles\u002Farticles\u002Fstart-with-docker-1-from-development-to-release-in-seconds.md","Start with Docker part 1 - From Development to Release in Seconds",{"type":20,"value":21,"toc":393},"minimark",[22,27,39,43,68,72,106,110,117,124,133,199,204,208,253,257,275,279,298,302,305,310,317,320,325,336,341,351,355,362,366],[23,24,26],"h3",{"id":25},"what-is-docker","What is Docker",[28,29,30,34,35,38],"p",{},[31,32,33],"strong",{},"Docker"," is a tool allowing us to build Containers with a pre-configured environment which can run on every computer with Docker installed. Docker uses special dockerfile which contains a list of commands to execute by the new container, and finally, run our ",[31,36,37],{},"application"," in precise the same environment among all our machines.",[23,40,42],{"id":41},"sample-usage","Sample usage",[28,44,45,46,49,50,53,54,57,58,61,62,61,65,67],{},"Let's imagine that you are ",[31,47,48],{},"hosting a web application"," with external database. Think about the time you have to spend on moving the application from your developer machine to the server. You are ",[31,51,52],{},"never sure"," that all versions of dependencies and frameworks on your development machine will fit the server machine. What is more, you also have to spend lots of time on the configuration of the server machine to ",[31,55,56],{},"fit the requirements",". Maybe your client will ask you to present the product but you are not sure that it will work on his computer. Those problems and much more will be ",[31,59,60],{},"solved"," ",[31,63,64],{},"with",[31,66,33],{},"!",[23,69,71],{"id":70},"some-history","Some history",[28,73,74,77,78,81,82,85,86,89,90,93,94,97,98,101,102,105],{},[31,75,76],{},"Docker Inc."," is a company built on the Docker project with more than a ",[31,79,80],{},"500 employees",", based in ",[31,83,84],{},"San Francisco",", California. The company was funded as ",[31,87,88],{},"dotCloud"," in 2010 and renamed to Docker in 2013. The year ",[31,91,92],{},"2014"," was the most successful for Docker when they announced a ",[31,95,96],{},"partnership with Microsoft"," and their services started being supported by ",[31,99,100],{},"Amazon Elastic Compute Cloud",". Docker is priced at around ",[31,103,104],{},"1B$",".",[23,107,109],{"id":108},"how-does-docker-work","How does Docker work",[28,111,112,113,116],{},"Understanding the way how Docker works is ",[31,114,115],{},"crucial"," to start using it in a real project.",[28,118,119],{},[120,121],"img",{"alt":122,"src":123},"Docker Screenshot","\u002Fimages\u002F5\u002Fdocker1.png",[125,126,128,129,132],"h4",{"id":127},"there-are-few-new-concepts-which-you-have-to-get-familiar-before-starting","There are few new concepts which you have to ",[31,130,131],{},"get familiar before starting",":",[134,135,136,169],"ul",{},[137,138,139,145,146,149,150,153,154,157,158,161,162,105],"li",{},[140,141,142],"em",{},[31,143,144],{},"Image"," is a ",[31,147,148],{},"lightweight environment"," prepared to run using as fewer resources as possible. Images are usually ",[31,151,152],{},"based on Linux",". The Images can be associated with ",[31,155,156],{},"Virtual Machines"," which ",[31,159,160],{},"are relatively similar",", despite they use more computer resources and work in a bit different way. If you want to read about differences between them, click ",[163,164,168],"a",{"href":165,"rel":166},"http:\u002F\u002Fwww.electronicdesign.com\u002Fdev-tools\u002Fwhat-s-difference-between-containers-and-virtual-machines",[167],"nofollow","here",[137,170,171,145,176,179,180,183,184,186,187,190,191,194,195,198],{},[140,172,173],{},[31,174,175],{},"Container",[31,177,178],{},"running instance of the image",". A container can run a few environments at the same time, but ",[31,181,182],{},"its recommended to divide your application into smaller environments"," to make them work independently and to ease the process of updating the software. The ",[31,185,175],{}," is connected straight-forward to the ",[31,188,189],{},"Kernel"," and use its resources in ",[31,192,193],{},"the most effective possible way",". One computer can run ",[31,196,197],{},"many containers"," at the same time.",[28,200,201],{},[120,202],{"alt":122,"src":203},"\u002Fimages\u002F5\u002Fdocker2.jpg",[125,205,207],{"id":206},"the-easiest-way-of-dividing-architecture-of-docker-is-to-divide-it-into-three-parts","The easiest way of dividing architecture of Docker is to divide it into three parts:",[134,209,210,224,237],{},[137,211,212,215,216,219,220,223],{},[31,213,214],{},"Client-side"," is responsible for ",[31,217,218],{},"sending commands to the host",". Most often, the user uses commands to communicate with the daemon. The client can use special ",[31,221,222],{},"Dockerfile"," which is allowing him to pre-configure the environment by giving a list of commands to execute and list of images to pull from the hub. Dockerfile is a recipe for our perfect environment.",[137,225,226,215,229,232,233,236],{},[31,227,228],{},"Host-side",[31,230,231],{},"handling user requests",". It also builds and hosts the containers, pulls the images from the cloud and makes sure, that all the files are accessible. Daemon is ",[31,234,235],{},"building a new image"," using pre-defined DockerFile.",[137,238,239,242,243,246,247,252],{},[31,240,241],{},"Registry"," which is a ",[31,244,245],{},"catalogue of the images"," stored in a cloud. The daemon can pull images from a public Docker cloud. We can explore it using ",[163,248,251],{"href":249,"rel":250},"https:\u002F\u002Fhub.docker.com\u002Fexplore\u002F",[167],"this"," link. Docker hub hosts images of eg. Ubuntu, node, MySQL, .NET Core and others.",[23,254,256],{"id":255},"before-we-start","Before we start",[28,258,259,260,263,264,267,268,271,272,105],{},"Before we start with our first example, ",[31,261,262],{},"make sure that Docker is installed on your machine",". All Community Edition (CE) versions are available to download ",[163,265,168],{"href":249,"rel":266},[167]," including Windows, Mac and Linux. ",[31,269,270],{},"NOTE:"," In terms of this tutorial, ",[31,273,274],{},"do not use Windows containers",[23,276,278],{"id":277},"first-docker-container","First Docker Container",[28,280,281,282,285,286,290,291,294,295,132],{},"The first container we create will be ",[31,283,284],{},"C# application based on .NET Core 2.1",". We can easily browse all images of .NET Core on the ",[163,287,289],{"href":249,"rel":288},[167],"official docker hub website",". Let's start by checking if our environment is configured correctly. To do this, ",[31,292,293],{},"open the Console"," (Windows cmd.exe) ",[31,296,297],{},"and type",[299,300],"script",{"src":301},"https:\u002F\u002Fgist.github.com\u002Fdawidstefaniak\u002F2ad53aa7a38404d17ccc9c6f9539d6f2.js",[28,303,304],{},"The output should look similar to this:",[28,306,307],{},[120,308],{"alt":122,"src":309},"\u002Fimages\u002F5\u002Fdocker3.png",[28,311,312,313,316],{},"Docker should ",[31,314,315],{},"automatically pull"," our repository from the cloud. \u000bWe can check if our image was correctly pulled using:",[299,318],{"src":319},"https:\u002F\u002Fgist.github.com\u002Fdawidstefaniak\u002Fcc0990aa635bbc46826d6c2630e77b8a.js",[28,321,322],{},[120,323],{"alt":122,"src":324},"\u002Fimages\u002F5\u002Fdocker4.png",[28,326,327,328,331,332,335],{},"As we can see, our image was pulled correctly. To start a new container, we have to ",[31,329,330],{},"run our image",". The most recommended way to start the container is to run the image using its IMAGE ID. In my example, it will be ",[140,333,334],{},"1eae85b77c3f",". The output should be similar to this:",[28,337,338],{},[120,339],{"alt":122,"src":340},"\u002Fimages\u002F5\u002Fdocker5.png",[28,342,343,344,347,348,105],{},"It means that our Hello World .NET Core program ",[31,345,346],{},"executed correctly"," and our environment is working properly. On the bottom of the output, we can see, that our platform was ",[31,349,350],{},".NET Core",[23,352,354],{"id":353},"next-steps","Next Steps",[28,356,357,358,361],{},"In the ",[31,359,360],{},"next Tutorial",", I will give you an overview of how to create your own container and execute your own .NET Core console application.",[23,363,365],{"id":364},"resources-and-further-reading","Resources and further reading:",[28,367,368,373,378,383,388],{},[163,369,372],{"href":370,"rel":371},"http:\u002F\u002Fdocs.geonode.org\u002Fen\u002Fmaster\u002Ftutorials\u002Finstall_and_admin\u002Frunning_docker\u002Fsetup_docker.html",[167],"Setup",[163,374,377],{"href":375,"rel":376},"https:\u002F\u002Fdocs.docker.com\u002Fengine\u002Fdocker-overview\u002F#docker-architecture",[167],"Official docks",[163,379,382],{"href":380,"rel":381},"https:\u002F\u002Fnordicapis.com",[167],"NordicApis Website",[163,384,387],{"href":385,"rel":386},"https:\u002F\u002Fwww.linux.com\u002Fwhat-is-linux",[167],"What is Linux",[163,389,392],{"href":390,"rel":391},"https:\u002F\u002Fen.wikipedia.org\u002Fwiki\u002FDocker,_Inc",[167],"Wikipedia",{"title":394,"searchDepth":395,"depth":395,"links":396},"",2,[397,399,400,401,402,403,404,405],{"id":25,"depth":398,"text":26},3,{"id":41,"depth":398,"text":42},{"id":70,"depth":398,"text":71},{"id":108,"depth":398,"text":109},{"id":255,"depth":398,"text":256},{"id":277,"depth":398,"text":278},{"id":353,"depth":398,"text":354},{"id":364,"depth":398,"text":365},"Docker is a tool allowing us to build Containers with a pre-configured environment which can run on every computer with Docker installed. Docker uses special dockerfile which contains a list of commands to execute by the new container, and finally, run our \u003Cstrong>application\u003C\u002Fstrong> in precise the same environment among all our machines.","md",{},true,"\u002Farticles\u002Fstart-with-docker-1-from-development-to-release-in-seconds",null,{"title":18,"description":406},"articles\u002Fstart-with-docker-1-from-development-to-release-in-seconds",[33,415,416,417,222],"DevOps","Containers","Dockercompose","QMCG-ud8Ade2y3M2u7kCa_0yqxh6UK0BrZb4KFG6zfc",{"left":4,"top":4,"width":5,"height":5,"rotate":4,"vFlip":6,"hFlip":6,"body":420},"\u003Cpath fill=\"currentColor\" d=\"M20 11v2H8l5.5 5.5l-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5L8 11z\"\u002F>",1779997852578]