Project

General

Profile

Actions

Task #479

open

Task #473: Docker learning phase 1

Docker learning phase 1 [Kim]

Added by Kim Le about 2 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Start date:
10/24/2023
Due date:
% Done:

100%

Estimated time:

Description

What is Docker?
- Docker is an open-source platform that automates the deployment, scaling, and management of applications within containers. Containers are lightweight, stand-alone, and executable packages that contain everything needed to run a piece of software, including the code, runtime, system tools, libraries, and settings. Docker provides a consistent environment for applications, ensuring that they run consistently and reliably across different environments.
When to use/not to use Docker?
- When to use Docker (Pros):
1. Portability
2. Isolation
3. Scalability
4. Consistency
5. Resource Efficiency
6. Microservices
7. Version Control
8. Continuous Integration and Continuous Deployment(CI/CD)
9. Ecosystem
When not to use Docker(Cons)
1. Resource Intensive
2. Complexity
3. Performance Overhead
4. Learning Curve
5. Not Suitable for All Workloads
6. Security Concerns
What is Docker-Compose?
- Docker Compose is a tool for defining and running multi-container Docker applications. It allows you to define a multi-container environment, including the services, networks, and volumes they rely on, using a single configuration file. With Docker Compose, you can manage complex applications that consist of multiple services, each running in a separate container, in a simple and declarative manner.
Common Docker/Docker-Compose commands?
Common Docker Commands
1. docker run: Create and start a container from an image
docker run -it --name my-container my-image
2. docker ps: List running containers
docker ps
3. docker ps -a *: List all containers, including stopped ones.
*docker ps -a

4. docker images: List available images on your system.
docker images
5. docker stop: Stop a running container.
docker stop my-container
6. docker start: Start a stopped container.
docker start my-container
7. docker restart: Restart a container.
docker restart my-container
8. docker rm: Remove a stopped container.
docker rm my-container
9. docker rmi: Remove an image.
docker rmi my-image
10. docker exec: Run a command in a running container.
docker exec -it my-image
11. docker build: Build an image from a Dockerfile.
docker build -t my-image
12. docker logs: View the logs of a container.
docker log my-container
Common Docker Compose Commands
1. docker-compose up: Create and start containers defined in a docker-compose.yml file.
docker-compose up
2. docker-compose up -d: Start containers in detached mode (in the background).
docker-compose up -d
3. docker-compose down: Stop and remove containers defined in a docker-compose.yml file.
docker-compose down
4. docker-compose ps: List containers defined in the docker-compose.yml file.
docker-compose ps
5. docker-compose logs: View the logs of services in the docker-compose.yml file.
docker-compose logs my-service
6. docker-compose exec: Run a command in a service container.
docker-compose exec my-service sh
7. docker-compose build: Build or rebuild services.
docker-compose build
8. docker-compose pull: Pull new images for services from Docker Hub.
docker-compose pull

No data to display

Actions

Also available in: Atom PDF