Solution TP 0

/images/k8s.jpeg

TP0 : Docker hands on

🇬🇧 English version

the manifest

Dockerfile :

1FROM nginx:alpine3.18
2COPY index.html /usr/share/nginx/html
3CMD ["nginx", "-g", "daemon off;"]

index.html :

1<!DOCTYPE html>
2<html>
3  <head>
4    <title>K8S training!</title>
5  </head>
6  <body>
7    <h1>It works !</h1>
8  </body>
9</html>

The commands :

Build the image :

docker build -t customnginx:1.0.0 .

List the image :

docker image ls

Run the image into a container :

docker run –name mycustomnginxcontainer -p 8001:80 customnginx:1.0.0

remove the container and the image

docker container stop CONTAINER_ID
docker container rm CONTAINER_ID
docker image rm customnginx:1.0.0

Latest Posts