Skip to content
This repository was archived by the owner on Mar 14, 2023. It is now read-only.

Commit 3203c24

Browse files
committed
Added labs Readme files
1 parent 93a2a72 commit 3203c24

File tree

67 files changed

+2671
-52
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+2671
-52
lines changed

L03-03 Cloud Native/Readme.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# L03-03
2+
3+
Head over to the [CNCF Web site](https://cncf.io) (cncf.io)
4+
5+
## Explore the various projects
6+
7+
Look at the Sandbox, Incubating and Graduated projects (Projects menu).
8+
9+
## Explore the Trail Map
10+
11+
Look at the Trail Map (Projects/Cloud Native Trail Map menu).
12+
13+
## Explore the Landscape diagram
14+
15+
From the Trail Map page, click on the Landscape link of use the Projects/Interactive Landscape menu on the CNCF Web site.

L04-03 Docker/Readme.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# L04-03
2+
3+
Let’s make sure that Docker Desktop is running.
4+
5+
If not already installed, head to the Docker site (https://www.docker.com/get-started), download and install it.
6+
7+
## Open the Docker Desktop Dashboard
8+
9+
On Windows, locate the system tray icon and select Dashboard.
10+
11+
On Mac, the icon will be located in the menu bar.
12+
13+
## Signin with your Docker account
14+
15+
Make sure you signed in to your Docker account.
16+
17+
## Enable Kubernetes
18+
19+
Kubernetes can run locally in Docker Desktop.
20+
21+
* Click on the **Settings icon** (gear) in the top right of the window.
22+
23+
* Select **Kubernetes**.
24+
25+
* Check **Enable Kubernetes**.

L05-02 Basic Commands/Readme.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# L05-02
2+
3+
Open a command prompt/terminal or use built-in terminal in Code using the **Terminal/New Terminal** menu or the **Ctrl-Shift-`** shortcut (that's a backtick).
4+
5+
Type the following Docker commands:
6+
7+
## Displays system information
8+
9+
docker info
10+
11+
## Displays the system’s version
12+
13+
docker version
14+
15+
## Log in to Docker Hub
16+
17+
docker login
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# L05-04
2+
3+
Type the following Docker commands:
4+
5+
## Pull and run a Nginx server
6+
7+
docker run -d -p 8080:80 --name webserver nginx
8+
9+
## List the running containers
10+
11+
docker ps
12+
13+
## List the images
14+
15+
docker images
16+
17+
## Attach to the container
18+
19+
docker container exec -it webserver bash
20+
21+
Exit by typing
22+
23+
exit
24+
25+
## Stop the container
26+
27+
docker stop webserver
28+
29+
## Remove the container from memory
30+
31+
docker rm webserver
32+
33+
## Remove the image
34+
35+
docker rmi nginx

L05-06 Build an image/Readme.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# L05-06
2+
3+
We want to containerize a simple HTML page. To do that you’ll need to create a Dockerfile.
4+
5+
## Add a Dockerfile file
6+
7+
Add a new file and name it **Dockerfile** (without any file extension).
8+
9+
Copy and paste the following in the file and save it:
10+
11+
FROM nginx:alpine
12+
COPY index.html /usr/share/nginx/html
13+
14+
## Build the image
15+
16+
docker build -t hello-world:v1 .
17+
18+
## list the images
19+
20+
docker images
21+
22+
## Let's create an instance of the image
23+
24+
docker run -d -p 8080:80 --name hello hello-world:v1
25+
26+
## List the containers running
27+
28+
docker ps
29+
30+
## Display the page using curl
31+
32+
curl localhost:8080
33+
34+
or use your browser. Navigate to https://localhost:8080
35+
36+
## Stop the container
37+
38+
Refresh the browser to confirm that it has stopped
39+
40+
docker stop hello
41+
42+
## List the containers running
43+
44+
You should not see the hello-world:v1 instance anymore.
45+
46+
docker ps
47+
48+
## Remove the instance from memory
49+
50+
docker rm hello
51+
52+
## Confirm that the container is no longer running
53+
54+
docker ps
55+
56+
## Is the image still present?
57+
58+
docker images
59+
60+
## Delete the image
61+
62+
docker rmi hello-world:v1

L06-02 Using VS Code/Readme.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# L06-02
2+
3+
This time, we'll containerize an Express app. To do that you’ll need to create a Dockerfile. The Express app files are located in the lab's folder.
4+
5+
## Add a Dockerfile file
6+
7+
Using the Code tooling, add a new Dockerfile by opening the Command Palette from the View menu.
8+
9+
Type **Docker Add** and select **Docker Add Docker Files to Workspace**.
10+
11+
## Build the image using Code
12+
13+
Open the Command Palette again and issue a **Docker Build**. Code will use the first part of the folder name as the tag. In this case: 04:latest. Not ideal but you can issue a **Docker Tag** to tag the image with something more useful like express:latest.
14+
15+
## Run an instance using Code
16+
17+
Open the Command Palette again and issue a **Docker Run**.
18+
19+
Point your browser to http://localhost:3000
20+
21+
## List the containers running
22+
23+
Click on the Docker icon in the left menu. You'll be able to see the imahe you just built and the instance that is running.
24+
25+
## Stop the instance
26+
27+
Right click on the instance name and stop it.
28+
29+
## Remove the image
30+
31+
Right click on the image name and delete it.

L07-02 Multi Stage Build/Readme.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# L07-02
2+
3+
This time, we'll containerize an .NET Core app.
4+
5+
## Generate the project
6+
7+
The project is already located in the lab's folder. It was created using this command:
8+
9+
dotnet new webapp
10+
11+
## Build the image
12+
13+
The Dockerfile is already created.
14+
15+
In the terminal, type the following commands:
16+
17+
docker build -t dotnetwebapp:latest .
18+
19+
## Run an instance
20+
21+
docker run -d -p 8080:5289 --name webapp dotnetwebapp:latest
22+
23+
## List the containers running
24+
25+
docker ps
26+
27+
## Display using the app
28+
29+
Point your browser to http://localhost:8080
30+
31+
## Cleanup
32+
33+
docker stop webapp
34+
docker rm webapp
35+
docker rmi dotnetwebapp:latest

L08-03 Docker Volumes/Readme.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# L08-03
2+
3+
## Open a terminal and create a volume
4+
5+
docker volume create myvol
6+
7+
## List the volumes
8+
9+
docker volume ls
10+
11+
## Run a Nginx container that will use the volume
12+
13+
docker run -d --name voltest -v myvol:/app nginx:latest
14+
15+
## Connect to the instance
16+
17+
docker exec -it voltest bash
18+
19+
## Let’s create a file in the volume using Nano
20+
21+
apt-get update
22+
apt-get install nano
23+
24+
## Create a file in the app folder
25+
cd app
26+
nano test.txt
27+
28+
Type something, save the file and exit Nano using:
29+
30+
CTRL-O
31+
CTRL-X
32+
33+
Detach from the instance:
34+
35+
exit
36+
37+
## Stop and remove the container
38+
39+
docker stop voltest
40+
docker rm voltest
41+
42+
## Run it again and see if the file still exists
43+
44+
docker run -d --name voltest -v myvol:/app nginx:latest
45+
docker exec -it voltest bash
46+
cd app
47+
cat test.txt
48+
49+
## Cleanup
50+
51+
docker volume rm myvol
52+
docker stop voltest
53+
docker rm voltest

L09-04 Docker Compose/Readme.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# L09-04
2+
3+
## Build the app
4+
5+
docker compose build
6+
7+
## Run the app
8+
9+
docker compose up -d
10+
11+
When the app will run, launch the voting app in your browser http://localhost:5000
12+
13+
14+
## List the containers
15+
16+
docker compose ps
17+
18+
## Look at the db container logs
19+
20+
docker compose logs -f web-fe
21+
22+
23+
## Compose V2 commands
24+
25+
LS will list the current projects
26+
27+
docker compose ls
28+
29+
## Let's try to deploy a second version
30+
31+
docker compose up -d
32+
33+
This fails because we can only run an app a single time
34+
35+
## Deploy a second version using a different project name
36+
37+
Let's now use a project name to see if we can deploy a second version
38+
39+
docker compose -p test up -d
40+
41+
This fails because the localhost port 5000 is already assigned.
42+
43+
Change the ports value from
44+
45+
- "5000:80"
46+
47+
to
48+
49+
- "5001:80"
50+
51+
## Deploy again
52+
53+
docker compose -p test up -d
54+
55+
How many versions do we have running?
56+
57+
docker compose ls
58+
59+
## Cleanup
60+
61+
docker compose down
62+
docker compose ls
63+
docker compose -p test down
64+
docker compose ls
266 KB
Loading

0 commit comments

Comments
 (0)