Introduction
Introduction aux microservices
Cloud Native
La CLI Docker
Visual Studio Code
Multi Stage Builds
Docker Compose
Registres de conteneurs
Les concepts de Kubernetes
L'API de Kubernetes
Namespaces
Nodes
Sélecteurs
Pods multi-conteneurs
Workloads
Mises-à-jour
Services
Stockage et persistance
Configurations applicatives
Observabilité
Tableaux de bords
Montée en charge

Comment créer des conteneurs Lab

L05-06

Hands-On Files

We want to containerize a simple HTML page. To do that you’ll need to create a Dockerfile.

Add a Dockerfile file

Add a new file and name it Dockerfile (without any file extension).

Copy and paste the following in the file and save it:

FROM nginx:alpine
COPY index.html /usr/share/nginx/html

Build the image

docker build -t hello-world:v1 .

list the images

docker images

Let’s create an instance of the image

docker run -d -p 8080:80 --name hello hello-world:v1

List the containers running

docker ps

Display the page using curl

curl localhost:8080

or use your browser. Navigate to https://localhost:8080

Stop the container

Refresh the browser to confirm that it has stopped

docker stop hello

List the containers running

You should not see the hello-world:v1 instance anymore.

docker ps

Remove the instance from memory

docker rm hello

Confirm that the container is no longer running

docker ps

Is the image still present?

docker images

Delete the image

docker rmi hello-world:v1
© Copyright AZCode, All Rights Reserved 

😀 Thanks to trying the sample lectures. As a thank you gift, use code “save10” at checkout to save $10 on your first order. One offer per account. Valid on the self-paced courses individual sales only.

Feedback / Suggestions

Course:

Lecture/Lab:

Comment créer des conteneurs Lab

If you have feedback or suggestions about this lecture or lab, please let us know in the box below