Skip to content

Instantly share code, notes, and snippets.

@neofob
Created October 20, 2017 18:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save neofob/e009469f1a82fd2f26d160a1f52c52b3 to your computer and use it in GitHub Desktop.
Save neofob/e009469f1a82fd2f26d160a1f52c52b3 to your computer and use it in GitHub Desktop.
docker slides

Yet Another Presentation on Docker

  • A Brief Sketch of Docker History
  • How to use it
  • What it is not

$ whoami

https://github.com/neofob

  • 1991 Pascal as 1st language
  • 2005s Checkpoint/Restart POSIX Threads
  • 2015+ A LITTLE bit of This, a Little bit of That
  • photography, cycling, typesetting..etc.

A Brief Sketch of Docker History

  • A Step Back in Time
  • How the Docker does it
  • Common Practice

A Step Back in Time

  • Before Docker, there were many others

Isolating resources is a common theme

  • 1979 Unix V7 chroot
  • 2000 FreeBSD Jails
  • 2001 Linux VServer
  • 2004 Oracle Solaris Containers
  • 2005 OpenVZ

Patching the Linux Kernel

  • 2006 Process Containers -> cgroups
  • 2008 cgroups + namespace = LXC
  • 2011 CloudFoundry Warden
  • 2013 LMCTFY
  • 2013 Docker

How the Docker does it

  • LXC = Docker
  • cgroups + namespace = Docker

Common Practice

  • Microservices
  • Setting Up a Base Image for certain Services
  • Rail
  • NodeJS
  • GoLang
  • gcc
  • Others

Docker in Action

tuan@m4700:~/src/notes$ docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
angr                0.0.1               d649a707db79        19 hours ago        845MB
ubuntu              16.04               747cb2d60bbe        7 days ago          122MB
debian              stretch             874e27b628fd        8 days ago          100MB
phusion/baseimage   0.9.22              877509368a8d        5 months ago        225MB
phusion/baseimage   latest              877509368a8d        5 months ago        225MB

Let's run angr

tuan@m4700:~/src/docker-angr$ docker run -it --rm \
-v $PWD/tests/test_angr.py:/tmp/test_angr.py \
--entrypoint /bin/bash angr:0.0.1
root@905b18a18836:/# ls -l /tmp 
total 4
-rwxrwxr-x 1 1000 1000 252 Oct 17 21:23 test_angr.py
  • -it: allocate a tty and run interactively
  • --rm: remove container on exit
  • -v $PWD/tests/test_angr.py:/tmp/test_angr.py
  • --entrypoint /bin/bash

Use a pre-built angr virtual environment

root@905b18a18836:/# workon
angr
root@905b18a18836:/# workon angr
(angr) root@905b18a18836:/#

Run a test script with angr

(angr) root@905b18a18836:/# cat /tmp/test_angr.py 
#!/usr/bin/env python

import angr
proj = angr.Project('/bin/true')
state = proj.factory.entry_state()
state.regs.rbp = state.regs.rsp
state.mem[0x1000].uint64_t = state.regs.rdx
state.regs.rbp = state.mem[state.regs.rbp].uint64_t.resolved
print state

Run a test script with angr

(angr) root@905b18a18836:/# /tmp/test_angr.py 
<SimState @ 0x4013d0>
(angr) root@905b18a18836:/# echo $?
0

What it is Not

  • !Virtual Machine
  • Multi-services in One Container

References

"The Internet is full of containers and half of them are made by Jess Frazelle." some Internet user

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment