Skip to content

Commit e73322b

Browse files
authored
Update Introduction-Docker-lab.md
1 parent ddb6d31 commit e73322b

File tree

1 file changed

+41
-9
lines changed

1 file changed

+41
-9
lines changed

Introduction-Docker-lab.md

Lines changed: 41 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
Here's the updated **Docker Assignment** with clear instructions for running Docker containers in each task:
2+
3+
---
4+
15
### **Docker Assignment: Getting Started with Images and Containers**
26

37
#### **Objective:**
@@ -8,9 +12,18 @@ Gain hands-on experience with Docker by pulling an image from Docker Hub, buildi
812
### **Assignment Tasks**
913

1014
#### **Task 1: Pull an Image from Docker Hub**
11-
1. Use the `docker pull` command to download the official **nginx** image from Docker Hub.
12-
2. Verify the image is available locally using the `docker images` command.
13-
3. Run a container from the **nginx** image and expose it on port 8080 of your host.
15+
1. Use the `docker pull` command to download the official **nginx** image from Docker Hub:
16+
```bash
17+
docker pull nginx
18+
```
19+
2. Verify the image is available locally using the `docker images` command:
20+
```bash
21+
docker images
22+
```
23+
3. Run a container from the **nginx** image and expose it on port 8080:
24+
```bash
25+
docker run -d -p 8080:80 nginx
26+
```
1427
4. Open a web browser and visit `http://localhost:8080` to confirm nginx is running.
1528

1629
---
@@ -22,23 +35,42 @@ Gain hands-on experience with Docker by pulling an image from Docker Hub, buildi
2235
FROM nginx:latest
2336
COPY index.html /usr/share/nginx/html/index.html
2437
```
25-
3. Add a custom `index.html` file to the same directory with personalized content (e.g., "Welcome to my custom nginx!").
38+
3. Add a custom `index.html` file to the same directory. Use the following content for `index.html`:
39+
```html
40+
<!DOCTYPE html>
41+
<html lang="en">
42+
<head>
43+
<meta charset="UTF-8">
44+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
45+
<title>Custom Nginx</title>
46+
</head>
47+
<body>
48+
<h1>Welcome to My Custom Nginx!</h1>
49+
<p>This page is served from a custom Docker image built by you.</p>
50+
</body>
51+
</html>
52+
```
2653
4. Build a new Docker image with the command:
2754
```bash
2855
docker build -t custom-nginx .
2956
```
30-
5. Verify the image is built using `docker images`.
3157

3258
---
3359

3460
#### **Task 3: Run a Container from the Custom Image**
35-
1. Run a container using the newly built `custom-nginx` image and expose it on port 9090.
61+
1. Run a container using the newly built `custom-nginx` image and expose it on port 9090:
62+
```bash
63+
docker run -d -p 9090:80 custom-nginx
64+
```
3665
2. Open a web browser and visit `http://localhost:9090` to verify the custom nginx page is displayed.
3766

3867
---
3968

4069
#### **Task 4: Push the Image to Docker Hub**
41-
1. Log in to Docker Hub using the `docker login` command.
70+
1. Log in to Docker Hub using the `docker login` command:
71+
```bash
72+
docker login
73+
```
4274
2. Tag your custom image to match your Docker Hub repository:
4375
```bash
4476
docker tag custom-nginx <your-dockerhub-username>/custom-nginx
@@ -63,8 +95,8 @@ Gain hands-on experience with Docker by pulling an image from Docker Hub, buildi
6395

6496
### **Evaluation Criteria**
6597
- Proper execution of all commands and tasks.
66-
- Successful creation and display of a custom web page.
98+
- Successful creation and display of the custom web page.
6799
- Correctly tagged and pushed image to Docker Hub.
68100
- Clarity and completeness of screenshots and documentation.
69101

70-
This assignment combines basic Docker operations with hands-on practice to reinforce key concepts.
102+
Let me know if you need further assistance or clarifications!

0 commit comments

Comments
 (0)