Week 4 Flashcards
(5 cards)
Scenario:
You join a DevOps team for a fintech app. The current system has poor version tracking and frequent deployment conflicts. You propose using Git and Docker to modernize the workflow.
a. Explain how Git and Docker solve these issues.
(6 marks)
b. Describe the difference between Git and GitHub, and clarify if one can work without the other.
(4 marks)
c. List any three Git commands, categorize their purpose, and give examples.
(5 marks)
Answer:
a.
Git: Enables version control with branching and history tracking to prevent conflicts.
Docker: Packages code and dependencies for uniform deployment, eliminating “it works on my machine” errors.
b.
Git: Local version control tool (offline).
GitHub: Cloud-based Git repository manager. Git works without GitHub; GitHub requires Git.
c.
Command Category Example
git init Repository setup Initialize project repo
git add . Stage changes Stage all files
git commit -m “msg” Save changes Commit to history
a. Explain the Git workflow including the role of branches and merging.
(4 marks)
b. Describe the function of the following commands:
i. git clone
ii. git push
iii. git pull
(3 marks)
c. A developer wants to roll back to a previous commit due to a broken feature. What command should they use and why?
(3 marks)
d. Mention one SCM alternative to Git and a unique feature it offers.
(3 marks)
a.
Developers create branches for features.
After testing, branches are merged back into main/master to finalize changes without disrupting stable code.
b.
git clone: Copy remote repo
git push: Upload local commits to remote
git pull: Fetch + merge latest remote changes
c.
Use git reset or git revert to undo changes depending on whether you want to preserve history or not.
d.
Mercurial: Uses DAGs (Directed Acyclic Graphs) to track changesets more robustly than Git.
Scenario:
Your team builds microservices and deploys frequently. You decide to use Docker for packaging and Kubernetes for scaling.
a. Explain the Docker container lifecycle from image to execution.
(5 marks)
b. Identify the three components of Docker Engine, and explain their function.
(4 marks)
c. What is the difference between a Docker image and a Docker container?
(3 marks)
a.
Build an image
Push/pull image from registry
Run container from image → container becomes running service
b.
Client: CLI for interacting with Docker
Server (daemon): Executes commands, manages images/containers
REST API: Defines interaction protocol
c.
Image: Template (read-only)
Container: Running instance (read-write, live environment)
a. Differentiate between virtualization and containerization. Give one tool used in each.
(4 marks)
b. Describe how Docker Registry is used in DevOps pipelines.
(3 marks)
c. Why is Docker called a lightweight virtualization technology?
(3 marks)
a.
Virtualization: Emulates full OS with hypervisors (e.g., VMware)
Containerization: Shares host OS kernel (e.g., Docker)
b.
Stores, distributes, and pulls pre-built images. Acts as a version-controlled artifact hub in CI/CD.
c.
Containers don’t need full OS, just app + dependencies. This minimizes overhead and speeds up startup time.
a. Outline the components of Docker Architecture:
Client
Host
Registry
(6 marks)
b. State two benefits and one challenge of using Docker in production.
(4 marks)
a.
Client: Sends build/run commands
Host: Runs Docker daemon and containers
Registry: Stores and manages Docker images (e.g., Docker Hub)
b.
Benefits:
Consistent environments
Rapid deployment
Challenge:
Complex multi-container orchestration without tools like Kubernetes