A simple Use Case of Docker
What is Docker?
Docker is an open-source containerization platform that uses OS-level virtualization for developing, shipping, and running applications.
Docker Architecture:
Docker uses a client-server architecture. The Docker client talks to the Docker daemon, which does the heavy lifting of building, running, and distributing your Docker containers. The Docker client and daemon can run on the same system, or you can connect a Docker client to a remote Docker daemon. The Docker client and daemon communicate using a REST API, over UNIX sockets or a network interface. Another Docker client is Docker Compose, which lets you work with applications consisting of a set of containers.
what are containers?
Docker defines containers as
Containers are an abstraction at the app layer that packages code and dependencies together. Multiple containers can run on the same machine and share the OS kernel with other containers, each running as isolated processes in userspace. Containers take up less space than VMs (container images are typically tens of MBs in size), can handle more applications, and require fewer VMs and Operating systems.
What are docker images?
An image is a read-only template with instructions for creating a Docker container. You might create your own images or you might only use those created by others and published in a registry. To build your own image, you create a Dockerfile with a simple syntax for defining the steps needed to create the image and run it. Each instruction in a Dockerfile creates a layer in the image. When you change the Dockerfile and rebuild the image, only those layers which have changed are rebuilt. This is part of what makes images so lightweight, small, and fast when compared to other virtualization technologies.
A container is a runnable instance of an image. You can create, start, stop, move, or delete a container using the Docker API or CLI. You can connect a container to one or more networks, attach storage to it, or even create a new image based on its current state.
What is a Docker registry?
A Docker registry stores Docker images. Docker Hub is a public registry that anyone can use, and Docker is configured to look for images on Docker Hub by default. You can even run your own private registry.
When you use the docker pull or docker run commands, the required images are pulled from your configured registry. When you use the docker push command, your image is pushed to your configured registry.
Use Case:
Oursky is an app design and development agency. They were early adopters of Docker.
Oursky says, “It’s interesting that our initial motivation for using Docker is trying out the latest technology (our company culture!). “
Their initial idea is to try docker to set up dev environments that support different languages, for example, Ruby and Python.
Oursky adopted docker not only in the deployment stage but also in the development and QA.
Benefits of using docker in Oursky:
Environment standardization: Docker documentation provides instructions to create an environment with a Dockerfile, that minimize the inconsistency between different environments.
In Oursky, they use docker-compose for development, testing, and production. The Dockerfile and docker-compose configuration files are committed to the code repository, such that every team member has access to use it to create their own development environment.
Faster configuration with consistency: Docker makes configurations easy. Simply put your configurations into code and deploy it. By saving configuration time, Oursky spent more time on important things like development or QA testing.
Better disaster recovery: Docker can back up a Docker image (also called “snapshot”) for the state of the container at that backup moment, and retrieve it later when serious issues happen.
Improvement in the adoption of DevOps: In Oursky’s workflow, they use the same container for testing and production. Docker has created a positive impact to make the process from testing to production smoother.
Standardization plays a key role in automation. Docker simplifies DevOps by standardizing the configuration interface and makes machine setup simpler.