Skip to content

Commit 6ffabe1

Browse files
authored
Update lab1-docker-introduction.md
1 parent bdee091 commit 6ffabe1

1 file changed

Lines changed: 52 additions & 14 deletions

File tree

lab1-docker-introduction.md

Lines changed: 52 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -53,22 +53,60 @@ Logout and Login before executing below commands
5353
4. Open a web browser and visit `http://localhost:8080` to confirm nginx is running.
5454

5555
---
56+
### **Lab 2: Working with Containers**
5657

58+
#### **Objective:**
59+
Understand how to start, list, interact with, and manage Docker containers.
5760

58-
### **Submission Requirements**
59-
1. Screenshots of the following:
60-
- Pulling the **nginx** image.
61-
- Running the default nginx container.
62-
- Custom **index.html** file content displayed in a browser.
63-
- Docker Hub repository showing the pushed image.
64-
2. Docker commands used for each task, listed step by step.
61+
#### **Tasks:**
6562

66-
---
63+
**Starting a Container:**
64+
Run a container using the **Ubuntu** image in interactive mode:
65+
```bash
66+
docker run -it ubuntu
67+
```
68+
Inside the container, run the command:
69+
```bash
70+
echo "Hello from Ubuntu!"
71+
```
72+
Exit the container by typing `exit`.
73+
74+
**Listing Containers:**
75+
View running containers:
76+
```bash
77+
docker ps
78+
```
79+
View all containers (including stopped ones):
80+
```bash
81+
docker ps -a
82+
```
83+
84+
**Stopping and Removing Containers:**
85+
Start a new **Alpine** container:
86+
```bash
87+
docker run -d --name my-alpine alpine sleep 300
88+
```
89+
Stop the container:
90+
```bash
91+
docker stop my-alpine
92+
```
93+
Remove the container:
94+
```bash
95+
docker rm my-alpine
96+
```
6797

68-
### **Evaluation Criteria**
69-
- Proper execution of all commands and tasks.
70-
- Successful creation and display of the custom web page.
71-
- Correctly tagged and pushed image to Docker Hub.
72-
- Clarity and completeness of screenshots and documentation.
98+
**Interactive Mode:**
99+
Run a new **nginx** container in detached mode:
100+
```bash
101+
docker run -d --name my-nginx nginx
102+
```
103+
Attach to the running container:
104+
```bash
105+
docker exec -it my-nginx bash
106+
```
107+
Run the command:
108+
```bash
109+
ls /usr/share/nginx/html
110+
```
111+
Exit the container's shell by typing `exit`.
73112

74-
Let me know if you need further assistance or clarifications!

0 commit comments

Comments
 (0)