This be a machine-translated text that may contain errors!
What be Docker?
Ye shall set up a web server onna landlubber’ Linux-server. One way to do it be to install the webserver an all dependencies directly inna server’s operating system. With Docker, ye can instead fetch a ready-made image an create a container from that.
Here ye’ll be able to explain the difference between an image an a container an show what Docker does ‘twixt a command an a runnin’ service. Ye need not install anythin yet.
Before ye begin: Can ye explain the difference ‘twixt a VM an a container? If ye be uncertain, start with Containere an virtual machines. There ye also see how Docker can run inside a Linux-VM on Proxmox.
Place in the course material: Docker be a tool fer containment. The kernel explains what the containers share. The overview map shows the relationship ‘twixt the operating system, VM, container, an tools.
Be docker as da tool dat’ handles de containers
Be docker can build an’ fetch images, create an’ start de containers, an’ handle de networks an’ storage fer dem. On a Linux-server, be Docker Engine does dis workin’.
When ye write docker run, ye use be Docker’s command-line client. Da client sends a request to be Docker service, dockerd, which handles de container. In da practice setup, both da client an’ da service runs inside da Linux-VM.
Ye can type da command in da VM’s console in Proxmox or in an SSH session to same VM. Both ways steer Docker on da same VM. Docker Desktop is another product dat bundles Docker tools into a desktop program; it ain’t necessary fer da server setup here.
One arr can be used fer multiple vessels
An arr is a bundle o’ files, programs, an’ settings used t’ forge a vessel. nginx:alpine be an example: nginx points to the name o’ the arr, an’ alpine be a mark, a label pointin’ to a variant o’ the arr. A mark may later point to a new version.
A vessel be its own instance forged from the arr, with its own name, state, an’ writable layer. The vessel may be created, runnin’, or stopped. Thus, a stopped program does not mean the vessel has been scuttled.
The arr doth not change when ye alter a file in the vessel’s writable layer. Should ye forge another vessel from the same arr, it shall possess its own writable layer.
Where does the image come from?
A container registry stores an’ distributes images. Docker Hub an’ GitHub Container Registry are two examples o’ that sortin’.
When a image’s in the registry but not on yer ship yet, ye can fetch it with docker pull. Ye might also forge yer own image from source code an’ a Dockerfile; ye’ll meet that beastie in Level 2.
| Term | In the webe server example |
|---|---|
| Registry | Docker Hub, where the Nginx image be fetched. |
| Image | nginx:alpine, the downloaded crate. |
| Container | min-nginx, a lone instance spawned from the crate. |
| Service | The web server answerin’ to HTTP requests while the program runs. |
What does the first commands mean, ye scallywags?
Ye need naught but to read this example fer now, matey. Installation an’ practical execution shall come later in [[Docker Level 1 - Get started|Level 1]].
# Pulls the alpine flavor of Nginx from the registry
# Sets sail with a detached vessel named "min-nginx", hoisting port 8080 on deck for port 80 aboard, usin' the alpine variant o' Nginx
# Checks which vessels are currently afloat in the harbor
docker pull nginx:alpine
docker run -d --name min-nginx -p 8080:80 nginx:alpine
docker ps
The first command fetches the image. The second creates and starts the vessel min-nginx, connectin’ the ship’s port 8080 t’ th’ hull’s port 80. The third shows runnin’ vessels. Nginx be the rig that answers calls; Docker handles the waters it sails in.
Guess what remains ye scurvy dog!
Ye got one image an’ two containers from it. Ye stopped an’ removed just the min-nginx.
- Does the image still be there?
- Will the
test-nginxvanish too? - Can ye create a new container from that image?
Check yer answer: The image is still here, an’ the test-nginx ain’t gone. Ye can make a fresh container from the same image. But files that were only in the writable layer of the min-nginx are lost when that container’s busted up.
Ye’re ready fer Level 1 if ye can explain the difference with yer own words an’ point out the registry, image, container, an’ service in the example. If ye mix up images an’ containers, use the diagram an’ try again with different container names. If ye want to dig deeper, explain why docker ps alone don’t show if the image exists or if a stowed-away container is still stored.
Onward Ye Scallywags!
[[Docker Level 1 - Get to it, matey|Install yer Docker Engine]]. Make use o’ the [[Containerization Level 1 - Containers an’ Virtual Machines|containment resources]] fer support when ye seek t’ spy on th’ relationship wit’ VMs an’ virtualin’.
Sources: Docker architecture, imagine an’ the container’s life cycle. The illustration be drawn fer this resource.