summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authormo khan <mo.khan@gmail.com>2020-06-10 16:50:24 -0600
committermo khan <mo.khan@gmail.com>2020-06-10 16:50:24 -0600
commit7263a3edf03b84abbdace78dd797d9184812b7db (patch)
tree06236714452db5b48c0a804c018bf8d98e2047a6 /README.md
initial commit
Diffstat (limited to 'README.md')
-rw-r--r--README.md176
1 files changed, 176 insertions, 0 deletions
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..61f6caa
--- /dev/null
+++ b/README.md
@@ -0,0 +1,176 @@
+---
+title: Developing with Docker
+author: gitlab.com/xlgmokha/developing-with-docker
+date: 2020-06-10
+---
+
+# Developing with Docker
+
+Mo Khan, Backend Engineer
+
+Composition Analysis, GitLab
+
+https://gitlab.com/xlgmokha
+
+Inspired by: gitlab-org/gitlab#216082
+
+# Agenda
+
+* Build (build)
+* Start/Stop container (ps, start, stop)
+* Getting a shell (run vs exec)
+* Analyzing an image (dive, docker layers)
+* Shrinking an image (compression, discuss the trade offs of having more v. less layers)
+* Sharing an image (push, pull, authn)
+
+# Definitions
+
+* Image: is like a class
+* Container: is like an instance of a class (i.e. object)
+
+# Definitions - Image/Container
+
+* Person is a class definition
+* "you" and "mo" are instances of the class Person
+* instances of person can interact with one another
+
+```ruby
+class Person
+ def fist_bump(other_person)
+ end
+end
+
+mo = Person.new
+you = Person.new
+
+mo.first_bump(you)
+```
+
+# Definitions
+
+Registry: stores images and makes them available to others
+
+For example:
+
+* https://index.docker.io
+* https://registry.gitlab.com
+
+```bash
+curl -s -i https://index.docker.io/v2/alpine/tags/list
+```
+
+# Docker - Architecture
+
+```plantuml
+
+```
+
+https://docs.docker.com/get-started/overview/#docker-architecture
+
+# Dockerfile
+
+A minimal Dockerfile:
+
+```file
+path: examples/001/Dockerfile
+relative: true
+lang: docker
+```
+
+https://docs.docker.com/engine/reference/builder/
+
+# Dockerfile - FROM
+
+> Initializes a build stage and sets a Base Image.
+
+In this example the base image is alpine:latest.
+By default this image will be fetched from the default Docker registry.
+https://index.docker.io/
+
+```file
+path: examples/001/Dockerfile
+relative: true
+lang: docker
+lines:
+ start: 0
+ end: 1
+```
+
+# Dockerfile - COPY
+
+Copy "hello.rb" from the host to
+"/usr/local/bin/hello" within the Docker image.
+
+```file
+path: examples/001/Dockerfile
+relative: true
+lang: docker
+lines:
+ start: 1
+ end: 2
+```
+
+```terminal8
+tree ./examples/001
+```
+
+# Dockerfile - RUN
+
+RUN a command from within the image and make "hello" executable.
+
+```file
+path: examples/001/Dockerfile
+relative: true
+lang: docker
+lines:
+ start: 2
+ end: 3
+```
+
+# Dockerfile - CMD
+
+Set the default command to run when the docker image
+is launched as a container.
+
+```file
+path: examples/001/Dockerfile
+relative: true
+lang: docker
+lines:
+ start: 2
+ end: 3
+```
+
+# docker build
+
+```terminal32
+bash -il
+```
+
+# docker ps
+
+# docker start
+
+# docker stop
+
+# docker run
+
+# docker exec
+
+# dive
+
+* Describe layers
+* Downloading multiple layers in parallel vs 1 large layer
+
+# Compression (zstd)
+
+More layers == more parallel download
+Smaller layers == faster downloads
+
+# Distribution
+
+# docker push
+
+# docker pull
+
+# docker login