Chapter 1
System Management
Course: Comptia Linux Xk0 006
Subject: Comptia Linux Xk0 006
Chapter: Scripting Orchestration And Automation
1. Container Management
Container management involves controlling the lifecycle, runtime behavior, and operational state of containers. It is essential for DevOps, system administrators, and developers working with microservices and containerized applications.
1. Starting / Stopping Containers
Starting a New Container from an Image
bash
docker run -d --name myweb nginx
Explanation:
- docker run: Command to create and start a new container
- -d: Detached mode (runs in the background)
- --name myweb: Assigns the container a readable name
- nginx: Specifies the image to use (Docker will pull it if not available locally)
Additional Options:
- Expose ports: bash docker run -d -p 8080:80 --name webapp nginx
- Run interactively (foreground): bash docker run -it ubuntu bash
Real-Life Use Case:
You deploy a static website using NGINX. Running it detached allows your server to continue functioning while the container handles HTTP requests: