Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Introduction to Docker

Introduction to Docker

Full overview about Docker, What it can be used for, it's architecture and the underling technologies, plus Docker versioning schema and installation guide.

Mohammed Zaghloul

May 20, 2017
Tweet

More Decks by Mohammed Zaghloul

Other Decks in Technology

Transcript

  1. Let me ask you ❏ Who knows about Docker ?

    ➔ Do you use it in development ? ➔ Do you use it in production ? ❏ Who tried but couldn’t do it ? ❏ Who uses Windows ? ❏ Who uses macOS ? ❏ Who uses Linux ?
  2. What is covered ? OVERVIEW What is docker ? What

    you should understand first ? What we can use docker for ? Docker architecture. Docker objects such as images and containers. The underlying technology behind Docker. SETUP Docker’s New Versioning scheme Installing on Windows 10 (Pro or Enterprise) Installing on Windows 7, 8, or 10 Home Edition Installing on Mac Installing on Linux Other Options More info about Docker can be found at https://goo.gl/w3iKIw
  3. WHAT IS DOCKER ? Docker is an open platform for

    developing, shipping, and running applications.
  4. “ Docker enables you to separate your applications from your

    infrastructure so you can deliver software quickly.
  5. Virtualization Isolated - Scalable - Easy to migrate Large -

    Performance overhead - Consume resource
  6. Containerization Lightweight -Save resources - Easy to migrate Less appropriate

    for multi-tenant environments, because of potential security risks.
  7. Virtual Machines Wastes resources Isolate systems Docker Containers Saves resources

    Isolate applications Both have different use cases You can think of VMs as houses (Fully self contained and have its own infrastructure) You can think of containers as apartments (Built around shared infrastructure)
  8. We can use Docker for Fast, consistent delivery of your

    applications Docker containers can standardize environments during dev lifecycle. Containers are great for continuous integration and continuous development (CI/CD) Code & run on local containers, automate or manually test on test containers and push images To production Responsive deployment and scaling Highly portable. Containers can run on local laptop, on physical or virtual machines in a data center, on cloud providers, or in a mixture of environments. Lightweight. Dynamically manage workloads, scaling up or tearing down applications and services as business needs dictate, in near real time Running more workloads on the same hardware A viable, cost-effective alternative to hypervisor-based virtual machines Perfect for high density environments and for small and medium deployments where you need to do more with fewer resources.
  9. Here’s how Docker works under the hood The Docker daemon

    is a service that runs on your host operating system. It currently only runs on Linux because it depends on a number of Linux kernel features, but there are a few ways to run Docker on MacOS and Windows too. REST API The Docker daemon itself exposes a REST API. From here, a number of different tools can talk to the daemon through this API. Docker CLI It is a command line tool that lets you talk to the Docker daemon. When you install Docker, you get both the Docker daemon and the Docker CLI tools together. https://goo.gl/RfyRx6
  10. “ You could describe Docker as a client <-> server

    application. The daemon is the server, and the CLI is 1 of many clients. You can use the client to manage many different components of the daemon such as images, containers, networks and data volumes. @nickjanetakis
  11. This is where we’re running various Docker commands. The client

    could be installed on your laptop running Windows, MacOS or a server running Linux, it doesn’t matter. This is where we find and download Docker images. Docker Hub and Docker Cloud are public registries that anyone can use, and Docker is configured to look for images on Docker Hub by default. This is typically referred to as the server running the Docker daemon. It’s the host that happens to be running the Docker daemon. The key take away here is, the client and the daemon does not need to be on the same box. https://goo.gl/RfyRx6
  12. DOCKER OBJECTS When you use Docker, you are creating and

    using images, containers, volumes, and other objects.
  13. “ Docker Image is the binaries and dependencies for your

    application and the metadata on how to run it @BretFisher
  14. Each Docker image references a list of read-only layers that

    represent filesystem differences. Layers are stacked on top of each other to form a base for a container’s root filesystem. The diagram shows the Ubuntu 15.04 image comprising 4 stacked image layers. https://goo.gl/j31qGf
  15. A new container, add a new, thin, writable layer on

    top of the underlying stack. This layer is often called the “container layer” All changes made to the running container - such as writing new files, modifying existing files, and deleting files - are written to this thin writable container layer. https://goo.gl/j31qGf
  16. Because each container has its own thin writable container layer,

    and all changes are stored in this container layer, this means that multiple containers can share access to the same underlying image and yet have their own data state. Two key technologies behind Docker image and container management are stackable image layers and copy-on-write (CoW). https://goo.gl/j31qGf
  17. The underlying technology Namespaces Used to provide the isolated workspace

    called the container. When you run a container. These namespaces provide a layer of isolation. Each aspect of a container runs in a separate namespace and its access is limited to that namespace. Control groups A cgroup limits an application to a specific set of resources. It also allow Docker Engine to share available hardware resources to containers and optionally enforce limits and constraints. Union file systems UnionFS are file systems that operate by creating layers, making them very lightweight and fast. Docker Engine uses UnionFS to provide the building blocks for containers. Container format Docker Engine combines the namespaces, control groups, and UnionFS into a wrapper called a container format. The default container format is libcontainer. In the future, Docker may support other container formats by integrating with technologies such as BSD Jails or Solaris Zones. Docker is written in Go and takes advantage of several features of the Linux kernel to deliver its functionality. https://goo.gl/w3iKIw
  18. INSTALLING DOCKER If you don't already have docker installed, Docker

    already has some great guides on how to do it
  19. INSTALLING DOCKER Installing on Windows 10 (Pro or Enterprise) This

    is the best experience on Windows, but due to OS feature requirements, it only works on the Pro and Enterprise editions of Windows 10 (with latest update rollups). You need to install "Docker for Windows" from the Docker Store. Installing on Windows 7, 8, or 10 Home Edition Unfortunately, Microsoft's OS features for Docker and Hyper-V don't work in these older versions, and "Home" edition doesn't have Hyper-V, so you'll need to install the Docker Toolbox, which is a slightly different approach to using Docker with a VirtualBox VM. Installing on Mac You'll want to install Docker for Mac, which is great. If you're on an older Mac with less then OSX Yosemite 10.10.3, you'll need to install the Docker Toolbox instead. Installing on Linux I prefer to use the Docker's automated script to add their repository and install all dependencies: curl -sSL https://get.docker.com/ | sh but you can also install in a more manual method by following specific instructions on Docker's site for your distribution, like this one for Ubuntu. https://goo.gl/xPJrrp What if None Of These Options Work Maybe you don't have local admin, or maybe your machine doesn't have enough resources. Well the best free option here is to use play-with-docker.com, which will run one or more Docker instances inside your browser, and give you a terminal to use it with.
  20. Detailed installation instructions Install Docker Community Edition (CE) on our

    machines and make sure it’s up and running Get started with Docker for Windows Get started with Docker for Mac Get Docker for Ubuntu Docker Toolbox Install Docker Toolbox on Windows Install Docker Toolbox on macOS
  21. Credits Special thanks to all the people who made and

    released these awesome resources for free: ▷ Presentation template by SlidesCarnival ▷ Photographs by Unsplash