code

Docker, 그것은 무엇이며 목적은 무엇입니까

codestyles 2020. 9. 22. 08:13
반응형

Docker, 그것은 무엇이며 목적은 무엇입니까


며칠 전에 Docker에 대해 들었고 건너보고 싶었습니다.

하지만 사실이 "컨테이너"의 목적이 무엇인지 모르겠습니다.

컨테이너 란?

개발 전용 가상 머신을 대체 할 수 있습니까?

간단히 말해서 회사에서 Docker를 사용하는 목적은 무엇입니까? 가장 큰 장점은?


VM Machine : VM Machine 소프트웨어를 사용하여 예를 들어 Ubuntu를 Windows 내에 설치할 수 있습니다. 그리고 둘 다 동시에 실행됩니다. CPU, RAM, 디스크, 네트워크 카드 등과 같은 핵심 구성 요소를 운영 체제 내에서 PC를 구축하고 조립하여 마치 실제 PC처럼 작동하는 것과 같습니다. 이런 식으로 가상 PC는 호스트라고하는 운영 체제가있는 실제 PC 내에서 "게스트"가됩니다.

컨테이너 : 위와 동일하지만 전체 운영 체제를 사용하는 대신 가상 OS의 "불필요한"구성 요소를 줄여 최소 버전을 만듭니다. 이로 인해 LXC (Linux 컨테이너)가 생성되며 VM 머신보다 빠릅니다.

Docker : 가상 머신 및 컨테이너와 달리 Docker 컨테이너는 별도의 운영 체제를 필요로하지 않거나 포함하지 않습니다. 대신 Linux 커널의 기능 에 의존 하고 리소스 격리를 사용합니다.
Docker의 목적 : 주요 초점은 소프트웨어 컨테이너 내부의 애플리케이션 배포를 자동화하고 Linux에서 운영 체제 수준 가상화를 자동화하는 것입니다. 표준 컨테이너보다 가볍고 몇 초 만에 부팅됩니다.ggg

(Docker의 경우 게스트 OS가 필요하지 않습니다.)


[참고,이 답변은 Linux 컨테이너에 중점을두고 있으며 다른 운영 체제에는 완전히 적용되지 않을 수 있습니다. ]

컨테이너 란?

앱입니다 . 컨테이너는 서로 격리 된 애플리케이션을 실행하는 방법입니다. 컨테이너는 여러 운영 체제를 실행하기 위해 하드웨어를 가상화하는 대신 여러 애플리케이션을 실행하기 위해 운영 체제 가상화에 의존합니다. 즉, 실행중인 OS 사본이 하나만 있고 앱의 각 인스턴스에 대해 메모리 및 CPU 코어를 사전 할당 할 필요가 없기 때문에 VM보다 동일한 하드웨어에서 더 많은 컨테이너를 실행할 수 있습니다. 다른 앱과 마찬가지로 컨테이너에 CPU 또는 메모리가 필요할 때이를 할당 한 다음 완료되면 해제하여 나중에 다른 앱이 동일한 제한된 리소스를 사용할 수 있도록합니다.

커널 네임 스페이스를 활용합니다 . 기본적으로 각 컨테이너는 다음과 같은 네임 스페이스가있는 환경을받습니다.

  • 마운트 : /컨테이너의 파일 시스템 /은 호스트 와 다릅니다 .
  • PID : 프로세스 ID, 컨테이너의 pid 1은 시작된 애플리케이션입니다.이 pid는 호스트에서 볼 때 달라집니다.
  • 네트워크 : 컨테이너는 기본적으로 자체 루프백 인터페이스 (127.0.0.1) 및 개인 IP로 실행됩니다. Docker는 Linux 브리지 네트워크와 같은 기술을 사용하여 자체 사설 LAN에서 여러 컨테이너를 함께 연결합니다.
  • IPC : 프로세스 간 통신
  • UTS : 여기에는 호스트 이름이 포함됩니다.
  • 사용자 : 선택적으로 모든 사용자 ID를 호스트의 ID에서 오프셋되도록 이동할 수 있습니다.

또한 이러한 각 네임 스페이스는 해당 격리를 명시 적으로 제거하지 않는 한 컨테이너가 호스트 또는 다른 컨테이너의 파일 시스템 또는 프로세스와 같은 것을 보지 못하게합니다.

기타 Linux 보안 도구 : 컨테이너는 SELinux, AppArmor, Capabilities 및 Seccomp와 같은 다른 보안 기능을 활용하여 루트 사용자를 포함한 컨테이너 내부의 사용자가 컨테이너를 탈출하거나 호스트에 부정적인 영향을 미치지 못하도록 제한합니다.

이식성을 위해 종속성과 함께 앱 패키징 : 컨테이너에 애플리케이션을 패키징하려면 애플리케이션 자체뿐만 아니라 해당 애플리케이션을 실행하는 데 필요한 모든 종속성을 이식 가능한 이미지로 조립해야합니다. 이 이미지는 컨테이너를 만드는 데 사용되는 기본 파일 시스템입니다. 응용 프로그램 만 격리하고 있기 때문에이 파일 시스템에는 전체 운영 체제를 가상화하는 데 필요한 커널 및 기타 OS 유틸리티가 포함되어 있지 않습니다. 따라서 컨테이너의 이미지는 동등한 가상 머신의 이미지보다 훨씬 작아야 네트워크를 통해 노드에 더 빠르게 배포 할 수 있습니다. 그 결과 컨테이너는 클라우드 및 원격 데이터 센터에 애플리케이션을 배포하는 데 널리 사용되는 옵션이되었습니다.

개발 전용 가상 머신을 대체 할 수 있습니까?

It depends: If your development environment is running Linux, and you either do not need access to hardware devices, or it is acceptable to have direct access to the physical hardware, then you'll find a migration to a Linux container fairly straight forward. The ideal target for a docker container are applications like web based API's (e.g. a REST app), which you access via the network.

What is the purpose, in simple words, of using Docker in companies ? The main advantage ?

Dev or Ops: Docker is typically brought into an environment in one of two paths. Developers looking for a way to more rapidly develop and locally test their application, and operations looking to run more workload on less hardware than would be possible with virtual machines.

Or Devops: One of the ideal targets is to leverage Docker immediately from the CI/CD deployment tool, compiling the application and immediately building an image that is deployed to development, CI, prod, etc. Containers often reduce the time to move the application from the code check-in until it's available for testing, making developers more efficient. And when designed properly, the same image that was tested and approved by the developers and CI tools can be deployed in production. Since that image includes all the application dependencies, the risk of something breaking in production that worked in development are significantly reduced.

Scalability: One last key benefit of containers that I'll mention is that they are designed for horizontal scalability in mind. When you have stateless apps under heavy load, containers are much easier and faster to scale out due to their smaller image size and reduced overhead. For this reason you see containers being used by many of the larger web based companies, like Google and Netflix.


Let me try to provide as simple answers as possible:

But in fact, I don't know what is the purpose of this "container"?

What is a container?

Simply put: a package containing software. More specifically, an application and all its dependencies bundled together. A regular, non-dockerised application environment is hooked directly to the OS, whereas a Docker container is an OS abstraction layer.

And a container differs from an image in that a container is a runtime instance of an image - similar to how objects are runtime instances of classes in case you're familiar with OOP.

Can it replace a virtual machine dedicated to development?

Both VMs and Docker containers are virtualisation techniques, in that they provide abstraction on top of system infrastructure.

A VM runs a full “guest” operating system with virtual access to host resources through a hypervisor. This means that the VM often provides the environment with more resources than it actually needs In general, VMs provide an environment with more resources than most applications need. Therefore, containers are a lighter-weight technique. The two solve different problems.

What is the purpose, in simple words, of using Docker in companies? The main advantage?

Containerisation goes hand-in-hand with microservices. The smaller services that make up the larger application are often tested and run in Docker containers. This makes continuous testing easier.

Also, because Docker containers are read-only they enforce a key DevOps principle: production services should remain unaltered

Some general benefits of using them:

  • Great isolation of services
  • Great manageability as containers contain everything the app needs
  • Encapsulation of implementation technology (in the containers)
  • Efficient resource utilisation (due to light-weight os virtualisation) in comparison to VMs
  • Fast deployment

참고URL : https://stackoverflow.com/questions/28089344/docker-what-is-it-and-what-is-the-purpose

반응형