-
Notifications
You must be signed in to change notification settings - Fork 1
/
608311de.2e579275.js
1 lines (1 loc) · 10.7 KB
/
608311de.2e579275.js
1
(window.webpackJsonp=window.webpackJsonp||[]).push([[22],{154:function(e,t,n){"use strict";n.r(t),n.d(t,"frontMatter",(function(){return o})),n.d(t,"metadata",(function(){return i})),n.d(t,"rightToc",(function(){return s})),n.d(t,"default",(function(){return b}));var a=n(2),r=n(9),c=(n(0),n(179)),o={id:"containers-docker",title:"Docker Basics"},i={id:"containers-docker",title:"Docker Basics",description:"What is Docker",source:"@site/docs/containers-docker.md",permalink:"/docs/containers-docker",editUrl:"https://github.com/analythium/analythium.github.io/edit/source/docs/containers-docker.md",lastUpdatedBy:"Peter Solymos",lastUpdatedAt:1675304109,sidebar:"docs",previous:{title:"Containers",permalink:"/docs/containers"},next:{title:"Shiny in Docker",permalink:"/docs/containers-shiny"}},s=[{value:"What is Docker",id:"what-is-docker",children:[]},{value:"Install Docker",id:"install-docker",children:[]},{value:"Docker concepts",id:"docker-concepts",children:[{value:"Docker Engine",id:"docker-engine",children:[]},{value:"Docker registries",id:"docker-registries",children:[]},{value:"Docker images",id:"docker-images",children:[]},{value:"Docker containers",id:"docker-containers",children:[]},{value:"Dockerfile",id:"dockerfile",children:[]},{value:"CLI commands",id:"cli-commands",children:[]}]}],l={rightToc:s};function b(e){var t=e.components,n=Object(r.a)(e,["components"]);return Object(c.b)("wrapper",Object(a.a)({},l,n,{components:t,mdxType:"MDXLayout"}),Object(c.b)("p",null,Object(c.b)("a",Object(a.a)({parentName:"p"},{href:"https://hosting.analythium.io/?utm_source=as-hub&utm_medium=web&utm_campaign=evergreen"}),Object(c.b)("img",Object(a.a)({parentName:"a"},{src:"https://hub.analythium.io/assets/marks/hosting-banner-2.jpg",alt:"Hosting Data Apps"})))),Object(c.b)("h2",{id:"what-is-docker"},"What is Docker"),Object(c.b)("p",null,"According to the ",Object(c.b)("a",Object(a.a)({parentName:"p"},{href:"https://docs.docker.com/"}),"Docker docs"),":"),Object(c.b)("blockquote",null,Object(c.b)("p",{parentName:"blockquote"},"Docker is an open platform for developing, shipping, and running applications. Docker enables you to separate your applications from your infrastructure so you can deliver software quickly. With Docker, you can manage your infrastructure in the same ways you manage your applications.")),Object(c.b)("p",null,"The rest of this page also relies heavily on the Docker Docs."),Object(c.b)("h2",{id:"install-docker"},"Install Docker"),Object(c.b)("p",null,"To download and install Docker for your platform of choice, visit\nthe ",Object(c.b)("a",Object(a.a)({parentName:"p"},{href:"https://docs.docker.com/get-docker/"}),"Docker download page"),"."),Object(c.b)("h2",{id:"docker-concepts"},"Docker concepts"),Object(c.b)("h3",{id:"docker-engine"},"Docker Engine"),Object(c.b)("p",null,"The Docker Engine is a client-server application that includes a ",Object(c.b)("em",{parentName:"p"},"server"),"\n(a long-running daemon process that listens to API requests, ",Object(c.b)("inlineCode",{parentName:"p"},"dockerd"),"), a ",Object(c.b)("em",{parentName:"p"},"REST API")," (specifies the interface that programs can use to talk to the daemon), and a\n",Object(c.b)("em",{parentName:"p"},"command line interface (CLI)")," (the client side, ",Object(c.b)("inlineCode",{parentName:"p"},"docker"),")."),Object(c.b)("p",null,"The CLI uses the REST API to control or interact with the Docker daemon.\nThe daemon creates and manages Docker objects, such as ",Object(c.b)("em",{parentName:"p"},"images"),",\n",Object(c.b)("em",{parentName:"p"},"containers"),", etc."),Object(c.b)("p",null,Object(c.b)("img",Object(a.a)({parentName:"p"},{src:"../../img/docker/architecture.png",alt:"Docker architecture",title:"Docker architecture"}))),Object(c.b)("h3",{id:"docker-registries"},"Docker registries"),Object(c.b)("p",null,"A Docker registry stores Docker ",Object(c.b)("em",{parentName:"p"},"images"),". ",Object(c.b)("a",Object(a.a)({parentName:"p"},{href:"https://hub.docker.com/"}),"Docker Hub")," is a public registry and Docker is configured to look for images on Docker Hub by default. There are many other registries, or users can have their own private registry."),Object(c.b)("h3",{id:"docker-images"},"Docker images"),Object(c.b)("p",null,"An image is a read-only template with instructions for creating a Docker ",Object(c.b)("em",{parentName:"p"},"container"),".\nAn image can be based on another image with additional customization on top of this\nso called ",Object(c.b)("em",{parentName:"p"},"base image"),"."),Object(c.b)("h3",{id:"docker-containers"},"Docker containers"),Object(c.b)("p",null,"A container is a runnable instance of an image. Users can create, start, stop a container using the Docker API or CLI. It is also possible to connect a container to networks or attach storage to it."),Object(c.b)("p",null,"By default, a container is isolated from other containers and the host machine. The degree of isolation can be controlled by the user, and depends on it is connected to networks, storage, other containers, or the host machine."),Object(c.b)("h3",{id:"dockerfile"},"Dockerfile"),Object(c.b)("p",null,"Docker builds images by reading the instructions from a ",Object(c.b)("inlineCode",{parentName:"p"},"Dockerfile"),".\nA ",Object(c.b)("inlineCode",{parentName:"p"},"Dockerfile")," is a text document that contains all the commands to assemble an image\nUsing the ",Object(c.b)("inlineCode",{parentName:"p"},"docker build")," CLI command. We will learn more about the\n",Object(c.b)("inlineCode",{parentName:"p"},"Dockerfile")," as part of the worked Shiny example."),Object(c.b)("h3",{id:"cli-commands"},"CLI commands"),Object(c.b)("p",null,"The most common Docker CLI commands are:"),Object(c.b)("ul",null,Object(c.b)("li",{parentName:"ul"},Object(c.b)("inlineCode",{parentName:"li"},"docker login"),": log into a Docker registry"),Object(c.b)("li",{parentName:"ul"},Object(c.b)("inlineCode",{parentName:"li"},"docker build"),": build a Docker image based on a ",Object(c.b)("inlineCode",{parentName:"li"},"Dockerfile")),Object(c.b)("li",{parentName:"ul"},Object(c.b)("inlineCode",{parentName:"li"},"docler push"),": push a locally build image to a Docker registry"),Object(c.b)("li",{parentName:"ul"},Object(c.b)("inlineCode",{parentName:"li"},"docker pull"),": pull an image from a registry"),Object(c.b)("li",{parentName:"ul"},Object(c.b)("inlineCode",{parentName:"li"},"docker run"),": run a command in a new container based on an image")),Object(c.b)("p",null,"We will learn more about these commands as part of the worked Shiny example."),Object(c.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(c.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(c.b)("h5",{parentName:"div"},Object(c.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(c.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(c.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"Further reading")),Object(c.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(c.b)("ul",{parentName:"div"},Object(c.b)("li",{parentName:"ul"},Object(c.b)("a",Object(a.a)({parentName:"li"},{href:"https://docs.docker.com/get-started/"}),"Get started with Docker")),Object(c.b)("li",{parentName:"ul"},Object(c.b)("a",Object(a.a)({parentName:"li"},{href:"https://www.freecodecamp.org/news/docker-simplified-96639a35ff36/"}),"Docker simplified")),Object(c.b)("li",{parentName:"ul"},Object(c.b)("a",Object(a.a)({parentName:"li"},{href:"https://docker-curriculum.com/"}),"Docker for beginners")),Object(c.b)("li",{parentName:"ul"},Object(c.b)("a",Object(a.a)({parentName:"li"},{href:"https://docs.docker.com/glossary/"}),"Docker glossary"))))),Object(c.b)("p",null,Object(c.b)("a",Object(a.a)({parentName:"p"},{href:"https://hosting.analythium.io/?utm_source=as-hub&utm_medium=web&utm_campaign=evergreen"}),Object(c.b)("img",Object(a.a)({parentName:"a"},{src:"https://hub.analythium.io/assets/marks/hosting-banner-2.jpg",alt:"Hosting Data Apps"})))))}b.isMDXComponent=!0},179:function(e,t,n){"use strict";n.d(t,"a",(function(){return p})),n.d(t,"b",(function(){return u}));var a=n(0),r=n.n(a);function c(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){c(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function s(e,t){if(null==e)return{};var n,a,r=function(e,t){if(null==e)return{};var n,a,r={},c=Object.keys(e);for(a=0;a<c.length;a++)n=c[a],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(a=0;a<c.length;a++)n=c[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var l=r.a.createContext({}),b=function(e){var t=r.a.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},p=function(e){var t=b(e.components);return r.a.createElement(l.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.a.createElement(r.a.Fragment,{},t)}},m=r.a.forwardRef((function(e,t){var n=e.components,a=e.mdxType,c=e.originalType,o=e.parentName,l=s(e,["components","mdxType","originalType","parentName"]),p=b(n),m=a,u=p["".concat(o,".").concat(m)]||p[m]||d[m]||c;return n?r.a.createElement(u,i(i({ref:t},l),{},{components:n})):r.a.createElement(u,i({ref:t},l))}));function u(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var c=n.length,o=new Array(c);o[0]=m;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i.mdxType="string"==typeof e?e:a,o[1]=i;for(var l=2;l<c;l++)o[l]=n[l];return r.a.createElement.apply(null,o)}return r.a.createElement.apply(null,n)}m.displayName="MDXCreateElement"}}]);