3. What will be in this talk
- Overview of docker features
- Overview of docker building blocks
- Comparison to other solutions
- Quick docker tutorial
- Dockerfile tips
4. What will not be in this talk
- Exploiting docker
- Details of deploying docker infrastructure
- Deep technical descriptions
9. Features - images
● Package every app in the same box
(dependencies, working everywhere)
● Isolate things from each other
● Standarized build procedure (Dockerfile)
19. Namespaces - GOAL
One of the overall goals of
namespaces is to support the
implementation of containers, a tool for
lightweight virtualization.
20. Namespaces - HOW
Wrap a particular global system
resource in an abstraction that makes
it appear to the processes within the
namespace that they have their own
isolated instance of the global resource
21. Namespaces - Result
Processes 'think' that they are
the only processes on the
system
22. Namespaces - Examples
- pid
- numbering
- hierarchy
- cannot kill / ptrace in other namespaces
- net
- 20 apaches at 80
- mount
36. PPuullll iitt!!
$ docker pull
busybox
● Search docker
registry for
repository of given
name
● Downloads the
repository
● Pulls only changes
next time
37. PPuullll iitt!!
$ docker pull
busybox
● Search docker
registry for repository
of given name
● Downloads the
repository
● Pulls only changes
next time
38. PPuullll iitt!!
$ docker pull
busybox
● Search docker
registry for repository
of given name
● Downloads the
repository
● Pulls only changes
next time
39.
40. RRuunn iitt!!
$ docker run
busybox:ubuntu-
14.04 echo
"hello"
● Make sure that image
is available
(downloads if not
found)
● Create a container
● Run a command
41. RRuunn iitt!!
$ docker run -it
busybox:ubuntu-
14.04 sh
● -it → makes container
interactive
● Create a container
● Give you a shell
access
42. More complicated example
● Run redis in a
container
● Run it as a deamon
● Bind it to network
● Make storage
persistent
43. RRuunn iitt!!
$ docker run -d -v
/var/docker/redis:/da
ta -p 6379:6379
--name=redis
dockerfile/redis
● -d → launch as
deamon
● -v
/var/docker/redi
s:/data → mount
directories
● -p 6379:6379 →
forward ports
44. RRuunn iitt!!
$ docker run -d -v
/var/docker/redis:/d
ata -p 6379:6379
--name=redis
dockerfile/redis
● -d → launch as
deamon
● -v
/var/docker/red
is:/data →
mount directories
● -p 6379:6379 →
forward ports
45. RRuunn iitt!!
$ docker run -d -v
/var/docker/redis:/da
ta -p 6379:6379
--name=redis
dockerfile/redis
● -d → launch as
deamon
● -v
/var/docker/redi
s:/data → mount
directories
● -p 6379:6379 →
forward ports
46. WWaattcchh iitt!!
$ docker ps
Prints out information
about docker
containers
47. WWaattcchh iitt!!
$ docker ps -a
Prints out information
about all docker
containers:
● Running
● Exited
48. WWaattcchh iitt!!
$ docker logs -t
--follow
romantic_enstein
Get logs from
stdin/stdout of
container
● -t → show timestamp
● --follow → similar to
tail -f
49. WWaattcchh iitt!!
$ docker inspect
romantic_enstein
Get info about
container
● Environment
variables
● Ports
● Links
51. TTiiddyy uupp
- docker rm
<container_id>
- docker rmi
<image_id>
● Docker images use
lots of space
● Docker images can
clog all your available
space on server (no
more pulling from
registry)
52. TTiiddyy uupp
$ docker ps -a | grep 'Exited' | awk '{print $1}' |
xargs docker rm
● Get ids of exited containers
● Remove containers with given ids
59. DOCKERFILE
FROM ubuntu
MAINTAINER me@me.me
# Install tmux
RUN
apt-get update && apt-get install tmux
RUN mkdir /home/hello
# Define working directory.
WORKDIR /home/hello
# Define default command.
CMD ["/bin/bash"]
60. DOCKERFILE
FROM ubuntu ← defines base imag
MAINTAINER me@me.me ← who is reponsible
# Install tmux
RUN
apt-get update && apt-get install tmux
RUN mkdir /home/hello ← let's run some
commands
# Define working directory.
WORKDIR /home/hello ← let's start here
# Define default command.
CMD ["/bin/bash"] ← default command to run
without arguments in run