Docker for software development

613 views

Running an application in a Docker container right now, and it works smoothly. However, I have some trouble understanding exactly what Docker does, what an image is, and what a container is

In: Technology

3 Answers

Anonymous 0 Comments

Docker provides a standard way to create, distribute, and run software. It’s a reliable way of providing compatibility because the standards are so strict; “it just works” because you’re simply not allowed to do the things that native software can do.

A Docker image is like a hard drive with an OS and applications installed on it. When you create a Docker image, it starts with an OS install (although this is typically done for you, so you don’t have to do it yourself). Then whatever applications are installed — but again, this is often done for you: if you just tell Docker you want a popular software package like Java, someone has already done the install so you can just use their install without doing it yourself.

So what’s inside your Docker image is not substantially different than what would be on your hard drive if you installed all that stuff manually.

When it comes time to run your Docker image, we call those containers. And we call them that because what’s going on inside of them is locked inside; Docker containers cannot access the host OS or software. It can’t even access your network or hard drive, unless you give it permissions to. Even then, the container only has the access you give it, so you can share one folder and it can’t see any of your other files.

Containerization is good for security (a virus in the container can’t escape the container and get into your machine), but also for stability. In a traditional software environment, software shares libraries and DLLs, so if something happens with a DLL or library (such as a patch or upgrade) can break a bunch of applications that were using them. With Docker, each container is completely independent with their own DLLs and libraries, so one container doing something crazy can’t affect the others.

One of the neat things, though, is layering the images. So if you have two containers that both use Java on Linux, you’ll just have one copy of Linux and one copy of Java that’s shared between containers — however, those layers are read-only. Any changes made in one container will not be seen by the other container, because each container has it’s own separate layer stacked on top of the read-only Linux and Java layers.

You are viewing 1 out of 3 answers, click here to view all answers.