2. What Is Docker?
Docker is a configuration management tool that helps a developer to wrap
an application and its dependencies into a Docker Container for the
development and deployment of software.
People and organizations have driven the demand for new applications to
new heights, so the pressure is on to keep up with the demand. The task
becomes easier if developers have the right tools. Docker is one such tool, a
popular platform dedicated to the development, shipment, and running of
applications.
Today, we will look at the best way to start using Docker. But before we get
into the nuts and bolts of implementation, let’s refresh our understanding
of this versatile and popular platform.
3. What Is Docker? Cont..
• When getting started with Docker, we first
need to understand Docker. Docker is an OS
virtualized software platform that allows IT
organizations to quickly create, deploy, and
run applications in Docker containers, which
have all the dependencies within them. The
container itself is a very lightweight package
with all the instructions and dependencies—
such as frameworks, libraries, and bins—
within it
4. Dockers place
The Docker container can be moved from environment to environment very easily. In
a DevOps life cycle, Docker really shines when used for deployment. When you deploy
your solution, you want to guarantee that the code tested will actually work in the
production environment. In addition, when you're building and testing the code, it's
beneficial to have a container running the solution at those stages because you can
validate your work in the same environment used for production.
You can use Docker throughout multiple stages of your DevOps cycle, but it is especially
valuable in the deployment stage, especially since it allows developers to use rapid
deployment. In addition, the environment itself is highly portable and was designed
with efficiencies that will enable you to run multiple Docker containers in a single
environment, unlike traditional virtual machine environments.
7. In the image, you’ll notice some major differences, including:
• The virtual environment has a hypervisor layer, whereas Docker has a Docker
engine layer.
• With a virtual machine, the memory usage is very high, whereas, in a Docker
environment, memory usage is very low.
• In terms of performance, when you start building out a virtual machine,
particularly when you have more than one virtual machine on a server, the
performance becomes poorer. With Docker, the performance is always high
because of the single Docker engine.
• In terms of portability, virtual machines just are not ideal. They’re still dependent
on the host operating system, and a lot of problems can happen when you use
virtual machines for portability. In contrast, Docker was designed for portability.
You can actually build solutions in a Docker container, and the solution is
guaranteed to work as you have built it no matter where it’s hosted.
• The boot-up time for a virtual machine is fairly slow in comparison to the boot-
up time for a Docker environment, in which boot-up is almost instantaneous
9. Challenge's in uses of dockers
• One of the other challenges of using a virtual machine is that if you have unused
memory within the environment, you cannot reallocate it. If you set up an
environment that has 9 gigabytes of memory, and 6 of those gigabytes are free,
you cannot do anything with that unused memory. With Docker, if you have free
memory, you can reallocate and reuse it across other containers used within the
Docker environment.
• Another challenge of virtual machines is that running multiples of them in a single
environment can lead to instability and performance issues. Docker, on the other
hand, is designed to run multiple containers in the same environment—it actually
gets better with more containers run in that hosted single Docker engine.
• Virtual machines have portability issues; the software can work on one machine,
but if you move that virtual machine to another machine, suddenly some of the
software won’t work, because some dependencies will not be inherited correctly.
Docker is designed to be able to run across multiple environments and to be
deployed easily across systems.
• The boot-up time for a virtual machine is about a few minutes, in contrast to the
milliseconds it takes for a Docker environment to boot up.
11. Advantages of Docker
• As noted previously, you can do rapid deployment using Docker. The
environment itself is highly portable and was designed with
efficiencies that allow you to run multiple Docker containers in a
single environment, unlike traditional virtual machine
environments.
• The configuration itself can be scripted through a language called
YAML, which allows you to describe the Docker environment you
want to create. This, in turn, allows you to scale your environment
quickly. But probably the most critical advantage these days is
security.
• You have to ensure that the environment you’re running is highly
secure yet highly scalable, and Docker takes security very seriously.
You’ll see it as one of the key components of the agile architecture
of the system you’re implementing.
• Now that you know the advantages of Docker, the next thing you
need to know in this getting started with docker tutorial is how it
works and its components.
12. How Does Docker Work?
• Docker works via a Docker engine that is
composed of two key elements: a server and a
client; and the communication between the
two is via REST API. The server communicates
the instructions to the client. On older
Windows and Mac systems, you can take
advantage of the Docker toolbox, which allows
you to control the Docker engine using
Compose and Kitematic.
13. Components of Docker
• There are four components that we will
discuss in this getting started with docker
tutorial:
• Docker client and server
• Docker image
• Docker registry
• Docker container
16. List of Docker Commands cont..
• Stop a running container
$docker stop [CONTAINER_NAME]
• Restart a running container
$docker restart [CONTAINER]
• Kill the running containers
$docker Kill [CONTAINER]
17. • Attach local standard input, output, and error
streams to a running container
$docker attach [CONTAINER]
• Block a container
$docker wait [CONTAINER]
• Pull an image from a registry
$docker pull [OPTIONS] NAME[:TAG]
18. • Push an image to a registry
$docker push [OPTIONS] NAME[:TAG]
• Run a command in a running container
$docker exec [OPTIONS] CONTAINER COMMAND
[ARG...]