what we’ll see in this block:
- What is docker?
- Docker platform
- You use docker for
- Docker architecture
- The underlying technology
Okay lets get started:
What is docker?
Docker is an open platform for developing , shipping and running applicatons.Docker enables you to separe your application from your infrastructure so you can delivery software quickly.With docker you can manage you infrastructure with the same like your applications
The Docker platform
Docker provides the ability to package and run an application in a loosely isolated environment called a container. The isolation and security allow you to run many containers simultaneously on a given host.
Container: Containers are lightweight and contain everything needed to run the application, so you do not need to rely on what is currently installed on the host. You can easily share containers while you work, and be sure that everyone you share with gets the same container that works in the same way.
Docker provides tooling and platform to manage the lifecycle of you containers:
- Develop your application and its supporting components using containers.
- The container becomes the unit for distributing and testing your application.
- When you’re ready, deploy your application into your production environment, as a container or an orchestrated service. This works the same whether your production environment is a local data center, a cloud provider, or a hybrid of the two.
Docker can be user for?
Main purpose docker developed is to give Fast , consisent delivery of your applications . Simply to make your development lifecycle easier and delivery products no time with testing and all other stuffs done using docker. Containers are great for continous integrations and continuous delivery (CI/CD) workflow.
- Responsive deployment and scaling
- Running more workloads on the same hardware
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..
The Docker daemon
The Docker daemon (
dockerd) listens for Docker API requests and manages Docker objects such as images, containers, networks, and volumes.
As I said earlier you deploy multiple containers in single infrastucture.Thats really awsome thing of docker.
The underlying technology
Docker is written in the Go programming language and takes advantage of several features of the Linux kernel to deliver its functionality. Docker uses a technology called
namespaces to provide the isolated workspace called the container. When you run a container, Docker creates a set of namespaces for that 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.
Its too simple just do these to run your first docker file:
- For Docker Desktop installation instructions, see Install Docker Desktop on Mac and Install Docker Desktop on Windows.
- Run the below command in CLI
docker run -d -p 80:80 docker/getting-started
-d- run the container in detached mode (in the background)
-p 80:80- map port 80 of the host to port 80 in the container
docker/getting-started- the image to use
The key terms you need to know in work with docker:
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.
An image is a read-only template with instructions for creating a Docker container. Often, an image is based on another image, with some additional customization. For example, you may build an image which is based on the
ubuntu image, but installs the Apache web server and your application, as well as the configuration details needed to make your application run.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 use Docker, you are creating and using images, containers, networks, volumes, plugins, and other objects. This section is a brief overview of some of those objects.
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.
The Docker daemon
The Docker daemon (
dockerd) listens for Docker API requests and manages Docker objects such as images, containers, networks, and volumes. A daemon can also communicate with other daemons to manage Docker services.
The Docker client
The Docker client (
docker) is the primary way that many Docker users interact with Docker. When you use commands such as
docker run, the client sends these commands to
dockerd, which carries them out. The
docker command uses the Docker API. The Docker client can communicate with more than one daemon.