diff options
| author | mo khan <mo.khan@gmail.com> | 2020-06-10 19:19:14 -0600 |
|---|---|---|
| committer | mo khan <mo.khan@gmail.com> | 2020-06-10 19:19:14 -0600 |
| commit | c5794d5b829ab12d09b535d8aaf2faad56cc6cf2 (patch) | |
| tree | e55888f3cf20e401702d97906d2251f84536e23b | |
| parent | 0f08fd690d9a03b29f88d7d71dfae2d31e7b6b5e (diff) | |
Tidy up notes on unix/tcp socket
| -rw-r--r-- | README.md | 105 |
1 files changed, 86 insertions, 19 deletions
@@ -15,47 +15,96 @@ Composition Analysis, GitLab # Agenda * Definitions -* Architecture -* Start/Stop container (ps, start, stop) -* Getting a shell (run vs exec) -* Dockerfile -* Analyzing an image (dive, docker layers) -* Shrinking an image (compression, discuss the trade offs of having more v. less layers) +* Ecosystem +* Build +* Analyze +* Optimize # Definitions -* Image: is like a class -* Container: is like an instance of a class (i.e. object) +* Image +* Container +* Registry -# Definitions - Image/Container +# Definitions - Image -* Person is a class definition -* "you" and "mo" are instances of the class Person -* instances of person can interact with one another +A Docker image is similar to a Ruby class. +A class defines the behaviour and data associated with the class. ```ruby class Person def fist_bump(other_person) end end +``` + +# Definitions +You can't do much with a class until you create +an instance of one. + +```ruby mo = Person.new you = Person.new +``` + +# Definitions - Objects +Once a class is instantiated you can invoke +methods on the object. An object can interact +with other objects. + +```ruby mo.first_bump(you) ``` -# Definitions +# Definitions - Container + +A container is a running instance of an image. +Similar to how an object is an instance of a class. + +| Ruby | Docker | +| -- | -- | +| Class | Image | +| Object | Container | + +# Identifiers + +Classes can be identified by their name. +Images can be identified by their image Id or `name:tag` + +Objects can be identified by their `object_id` in Ruby. +Containers can be identified by their container Id or a name. + +| Ruby | Docker | +| -- | -- | +| Person | Image ID | +| mo.object_id | Container ID | + +# Image identifier + +[registry]name:tag + +If the registry is ommitted, then docker.io is assumed. + +* registry.gitlab.com/gitlab-org/security-products/license-management:latest +* alpine:latest + +Note: TLS is assumed transport + +# Definitions - Registry Registry: stores images and makes them available to others +This include metadata about images and blobs for each layer in the image. + For example: -* https://index.docker.io +* https://registry-1.docker.io * https://registry.gitlab.com ```bash -curl -s -i https://index.docker.io/v2/alpine/tags/list +curl -s -i https://registry-1.docker.io/v2/alpine/tags/list ``` # Architecture @@ -68,11 +117,11 @@ curl -s -i https://index.docker.io/v2/alpine/tags/list | pull | | run | ---------- - | + | (tcp/unix socket) V - -------------- - | Host | - -------------- + --------------- + | Docker Host | + --------------- | Daemon | | Containers | | Images | @@ -88,6 +137,24 @@ curl -s -i https://index.docker.io/v2/alpine/tags/list https://docs.docker.com/get-started/overview/#docker-architecture +# /var/run/docker.sock + +```bash +$ curl --unix-socket /var/run/docker.sock http://localhost/images/json +``` + +```terminal16 +curl -i --unix-socket /var/run/docker.sock http://localhost/images/json +``` + +# $ docker + +The docker CLI is an HTTP client that can connect to Unix or TCP sockets. + +```terminal32 +docker version +``` + # $ docker image ls ```terminal8 |
