Skip to main content

Posts

Showing posts from March 12, 2017

Docker Default Executable

Docker Default Executable A Default Executable is the command that will run when the container is started. It is defined in the Dockerfile as an ENTRYPOINT or CMD instruction. CMD and ENTRYPOINT instructions both define the startup command for a container. You can enter one or the other, or both in the Dockerfile. This example runs the debian container and starts a shell . The default executable, the shell , is defined in the Dockerfile as a default executable. If a default executable is not specified in the Dockerfile and an argument is not given at the command line, the container will error out when called: The above error can be remedied by entering the starting command at the command line. In this example, the shell, sh , is given as the starting command: Entry Point instruction An ENTRYPOINT allows you to configure a container to behave as

Docker Container

Container A container is a lightweight, portable encapsulation of an environment in which to run applications. It shares the kernel of the host system and is isolated from other containers in the system. is a running instance of a Docker image an image can be thought of an architectural drawing of a house; a container is a house built based on that drawing; several houses can be built from the drawing, optionally with differences, e.g. color, roof type, additions/replacements Following the programming analogy, if an image is a class, a container is an instance of a class—a runtime object To instantiate a container, Docker engine takes the image, adds a writable layer, and initializes settings such as network ports, container name, ID and resource limits Because each container has its own thin writable container layer, and all changes are stored in this layer, multiple co

Docker Image

Docker Image Similar in concept to a class in object-oriented programming Can be built or updated from scratch or existing images can be downloaded and used Images can be thought of as golden images. They are read-only. They cannot be modified except by modifying the associated container, then "committing" the changes to a new image Dockerfile is to Image as Source Code is to Executable: Docker images are stored as a series of read-only layers: When a container is started, Docker adds a read-write layer on top of the read-only layers/images: Licensed under a Creative Commons Attribution 4.0 International License .

Dockerfile

Dockerfile A Docker Image is built from a simple, descriptive set of steps called instructions , which are stored in a text file called a Dockerfile . To create an image from a Dockerfile, the Docker daemon reads the file, executes the instructions, and outputs an image. Dockerfile Has been described as the source code of the image or an artifact that describes how a Docker image is created Dockerfile is a text file with two types of entries: # Comment a line beginning with a hash symbol, used to insert comments into the file INSTRUCTION instructions are executed in order listed, each one creating a layer in the image uppercase names used by convention Example Dockerfile: # Start with ubuntu 16.04 FROM ubuntu:16.04 MAINTAINER neokobo.blogspot.com # Instruction with three components RUN apt-get update && apt-get install emacs24 && apt-get clean CMD ["/bin/bash&

Docker Installation Platform

Docker Installation Platform Linux Later versions of 64-bit Ubuntu, RHEL 7, CentOS 7, Fedora 24, 25, Debian, Oracle Linux 7 with UEK 4, SLES 12, and others Mac Docker for Mac 2010 or newer model OS X El Capitan 10.11 and newer Windows Docker for Windows 64bit Windows 10 Pro, Enterprise / Education with Microsoft Hyper-V AWS Azure Docker Toolbox Support for older Windows and macOS versions References: docs.docker.com/engine/installation/

Docker Components

Docker Components Docker is a Container management tool. It consists of core technologies such as images and union filesystems, administration and management software such as the Docker engine and Swarm, concepts such as layers, and tags, supporting plug-ins for volumes and networks, and more. In the next several posts, I will describe some of these main components, including: Docker Installation Platform File Systems and Layer Objects: Dockerfile, Image, Container, etc. Docker Host Docker Storage Docker Networking Docker Swarm Docker Compose

Docker Layered Environment

A Layered Environment A docker image is built up of layers. Each layer represents a portion of the images' filesystem that either adds to or replaces (overlays) the layer below it. For instance you might start with a Debian base image, add the Emacs editor, and the nginx reverse proxy server. Each of these is a distinct layer. Finally, to instantiate a container, the image is loaded into memory and a writable layer is added. This is where changes during runtime are kept. The topology consists of the following components: Kernel this is the kernel of the host operating system shared across all containers on host Bootfs boot filesystem (with bootloader and kernel) same across different Linux distributions Base image binaries/libraries functionality needed by the container, not in the host OS kernel Rootfs root filesystem (with required directories: /bin, /boot, /dev, /lib, …) differences acr

Container and the Host OS Kernel

Container and the Host OS Kernel Docker uses the host operating systems' kernel as a base. All containers which run on the host share this kernel. Any required resources not in the host kernel (e.g. binaries, libraries, frameworks, etc.) will be provided by the container's base image and any additional application layers. If Docker is deployed on top of an Ubuntu Linux OS, containers built on this host will use the Ubuntu kernel. Examples of other OS kernels deployments include: Boot2docker is a lightweight Linux distribution based on a stripped down Tiny Core Linux developed to run Docker containers Based on a recent Linux kernel (4.4.41 as of Docker 1.12.6) with AUFS storage driver Container Linux formerly CoreOS an open-source lightweight operating system based on the Linux kernel  provides minimal functionality required for deploying applications inside