...

/

Docker Kata 4: Running a Web Server in a Container

Docker Kata 4: Running a Web Server in a Container

Learn to run a web server in a container and view its default page.

Containers are useful as components of complex information systems. Web servers are, of course, an important component of any web-based application. This kata will demonstrate how containers can be used to run a web server.

Step 1: Run a web server

The command to stop and remove all the containers is given below.

Press + to interact
docker container stop $(docker container ls -q)
docker container rm $(docker container ls -aq)

The output will be something like this:

Commands

Parameter

Description

docker container stop $(docker container ls -q)

This stops and removes all the containers.

docker container rm $(docker container ls -aq)

These commands stop and remove all the containers.

The command to run a disconnected NGINX container is given below.

Press + to interact
docker container run -d -p 80:80 --name webserver nginx

When ...