its dependencies in a virtual container that can run on any Linux server. This helps enable flexibility and portability on where the application can run, whether on premise, public cloud, private cloud, bare metal, etc. “ ” Source: 451 Research (Emphasis Mine)
an abstraction and automation framework for deploying applications on Linux containers (LXC) • Provides process isolation (sandboxing) • Does not require a virtualized environment, runs on the host OS What is Docker?
format (alternative to Docker) • Locksmith: Reboot Manager, allows you to smartly reboot segments of a cluster and ensure zero interruptions • Many more… Other Tools
image • Creates images after each step as required • Caches and will re-use any step that it can • The container will continue running for as long as the CMD is running the foreground. Will only run the last CMD • With Deis, you may only EXPOSE one port Dockerfile Example: memcached
is the build Context • Use .dockerignore file to ignore files in the CWD. Users Go’s filepath.Match pattern matching • Use WORKDIR to change CWD • Use ADD to add additional files, directories, or remote files o ADD <src> <dest> o # Required for paths with whitespace ADD ["src", “dest”] o Supports wildcards Context
• CMD: The default process, or arguments the container is going to run when run – ENTRYPOINT: A default command to which default arguments from CMD, or those passed in via docker run, are passed. • Relative to the WORKDIR • Runs as root unless changed with USER Running Commands
form: [“executable”, “param1”, “param…”] – shell form: command param1 param… • CMD also takes just arguments to pass to the ENTRYPOINT: – [“param1”, “param…”] • exec and param form do not perform shell interpolation of params (e.g. $USER or `hostname`) Running Commands
base for another image • Allows you to call any other Dockerfile instruction (some may not make sense however) • For example: the base ubuntu image could ensure that apt-get update is always run whenever you build upon that base image. – ONBUILD RUN apt-get update -qq Deferred Commands
the context, it copies it from the context into the resulting image • Two syntaxes: – COPY <src> <dest> – COPY [“src”, “dest”] • Supports wildcards • Relative to the WORKDIR Copying Files
Volumes are shared with the host, or other containers • Set at runtime • Files created within the VOLUME path prior to running are copied over to the mounted share at runtime Sharing Files
the container o -p: bind container and host port o <image>: the image to launch • docker ps: shows currently running containers • telnet <host> 11211: telnet to the mecached daemon • docker stop <hash or name>: stop the container Demo
(useful for with custom run commands) • Bind to host: o -p: bind host port to container port: -p <host>:<container> o -P: bind all exposed ports to a random ports on the host – Find ports: docker port <container> <container port> Ports
name • Sets ENVironment variables and • Updates /etc/hosts file • Doesn’t require ports be exposed to the outside (e.g. using -p or -P) Linking Containers