๐ณ What is Docker?
Docker is a container-based virtualization technology that allows applications and their dependencies to be packaged into containers, enabling them to run consistently across different environments.
Unlike virtual machines (VMs), which virtualize an entire operating system, Docker shares the host OS kernel while providing isolated environments for applications.
Key Concepts of Docker
1. Container
A container is an independent unit that includes an application and all its dependencies, ensuring that it runs in a consistent environment across different platforms.
2. Image
An image is a read-only template that contains everything needed to create a container, including the application, libraries, and configuration files.
- Containers are created from images.
3. Dockerfile
A Dockerfile is a script that defines how to build a Docker image, specifying package installations, environment variables, and execution commands.
4. Docker Hub
Docker Hub is a repository for Docker images, where both official and user-created images can be stored and shared.
- Users can download and deploy images easily.
5. Docker Compose
Docker Compose is a tool for defining and running multi-container applications using a docker-compose.yml file.
- It simplifies managing multiple containers as a single service.
Advantages of Docker
Consistent Environments
- Ensures that applications run the same way across development, testing, and production environments.
Fast Deployment & Scalability
- Lightweight and fast to start.
- Easily deploy and scale multiple containers.
Resource Efficiency
- Uses fewer resources than virtual machines by sharing the host OS kernel, reducing overhead.
Microservices Architecture Support
- Enables independent deployment and management of services, making it ideal for microservices.
Essential Docker Commands
Check Docker Version
# sudo docker --version
docker --version
Download a Docker Image
# sudo docker pul [image-name]
docker pull [image-name]
Run a Docker Container
# sudo docker run -d -p 8080:80 --name [container-name] [image-name]
docker run -d -p 8080:80 --name [container-name] [image-name]
List Running Containers
# sudo docker ps
docker ps
# sudo docker ps -a
docker ps -a
Stop & Remove a Container
# sudo docker stop [container-name]
docker stop [container-name]
# sudo docker rm [container-name]
docker rm [container-name]
Remove an Image
# sudo docker rmi [image-name]
docker rmi [image-name]
Summary
Feature | Description |
Container | Isolated unit that packages an application and its dependencies. |
Image | Read-only template used to create containers. |
Dockerfile | Script to define and build a Docker image. |
Docker Hub | Repository to store and share Docker images. |
Docker Compose | Tool to manage multiple containers with a single file. |
Advantages | Fast, lightweight, and supports microservices. |
Docker provides a lightweight, efficient, and portable way to develop and deploy applications, making it a powerful tool for modern software development.
'๊ฐ๋ฐ Code > ๋ถ๋ก Supplement' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[Supplement][Docker] Building and Managing Docker Images (0) | 2025.02.12 |
---|---|
[Supplement][Docker] ๋์ปค ์ด๋ฏธ์ง ๋น๋ ๋ฐ ๊ด๋ฆฌ (0) | 2025.02.09 |
[Supplement][Docker] Docker ๊ฐ๋ ์ ๋ฆฌ (0) | 2025.02.07 |