0% found this document useful (0 votes)
4 views10 pages

Lecture Notes 1.2.2 (Containers and Shell, Creating Docker Images, Backing Up a Docker Container)

The document provides an overview of containerization using Docker, highlighting the importance of accessing container shells for debugging, configuration, and monitoring. It outlines the steps to create custom Docker images and back up Docker containers, emphasizing the benefits of customization, reproducibility, and disaster recovery. Additionally, it includes resources such as video links, textbooks, and reference materials for further learning.

Uploaded by

245040002
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views10 pages

Lecture Notes 1.2.2 (Containers and Shell, Creating Docker Images, Backing Up a Docker Container)

The document provides an overview of containerization using Docker, highlighting the importance of accessing container shells for debugging, configuration, and monitoring. It outlines the steps to create custom Docker images and back up Docker containers, emphasizing the benefits of customization, reproducibility, and disaster recovery. Additionally, it includes resources such as video links, textbooks, and reference materials for further learning.

Uploaded by

245040002
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 10

UNIVERSITY INSTITUTE OF COMPUTING

Master of Computer Application


Cloud Computing & DevOps
Subject Name: Containerization with docker
23CAH-732

DISCOVER . LEARN . EMPOWER


1
Course Outcome
CO3: Analyze the containerization of OS images to
deploy applications over Docker

2
Containers and Shell

Containers are isolated environments in which applications can run. They include the
application and its dependencies but share the host system's kernel.

Why Access the Container Shell?

Accessing the shell of a container is necessary for:

· Debugging: Troubleshoot issues by directly interacting with the running application.


· Configuration: Adjust settings or modify files within the container.
· Monitoring: Check the state of the application and its dependencies in real-time.
Containers and Shell

To access the shell of a running container:

1. List running containers:


docker ps

2. Access the shell:


docker exec -it <container_id> /bin/bash
Replace <container_id> with the actual container ID.
Creating Docker Images

Why Create Custom Docker Images?

Creating custom Docker images is important because:

· Customization: Tailor the environment to meet the specific needs of your


application.

· Reproducibility: Ensure consistent environments across different development,


testing, and production stages.

· Dependency Management: Bundle all necessary dependencies, libraries, and


configuration files.
Creating Docker Images

Steps to Create Docker Images

1. Create a Dockerfile: A Dockerfile is a text document that contains instructions for building a Docker image.
Dockerfile
* Use an official Python runtime as a parent image
FROM python:3.8-slim
* Set the working directory in the container
WORKDIR /app
* Copy the current directory contents into the container at /app
COPY . /app
* Install any needed packages specified in requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
* Make port 80 available to the world outside this container
EXPOSE 80
* Define environment variable
ENV NAME World
* Run app.py when the container launches
CMD ["python", "app.py"]
2. Build the image:
docker build -t my-python-app .
3. Run the container:
docker run -p 4000:80 my-python-app
Backing Up a Docker Container

Why Back Up a Docker Container?

Backing up a Docker container is necessary to:

· Preserve State: Save the current state of a container, including all data and
configuration changes.

· Disaster Recovery: Restore the container to a previous state in case of failure or


data loss.

· Migration: Move the container to a different host or environment without losing its
state.
Backing Up a Docker Container

Steps to Back Up a Docker Container

1. Commit the container to an image:


docker commit <container_id> my_backup_image

2. Save the image to a tar file:


docker save -o backup.tar my_backup_image
Resources

Video Links:
https://youtu.be/Gjnup-PuquQ
https://youtu.be/wi-MGFhrad0
https://youtu.be/a1M_thDTqmU

Textbooks:
1. Matthias, Karl, and Sean P. Kane. Docker: Up and Running. 2nd ed., O'Reilly Media, 2018.
2. Bullington-McGuire, Richard, Andrew K. Dennis, and Michael Schwartz. Docker for Developers: Develop and Run Your
Application with Docker Containers. 1st ed., Apress, 2019.

Reference Books:
3. Turnbull, James. The Docker Book: Containerization is the New Virtualization. 1st ed., James Turnbull, 2014.
4. Freeman, Emily. DevOps for Dummies. 1st ed., For Dummies (Wiley), 2019.

Web Links:
• Docker Documentation
• Docker Tutorial

9
THANK YOU

10

You might also like