This is a containerized echo web server that will respond to HTTP requests. This web server will be hosted on http://localhost:5000.
- GET: Responds with query arguments returned in JSON format.
- POST (standard): Responds with form data of request in JSON format.
- POST (Content-type:application/json): Return JSON body.
Built using:
- docker
- python3
To run the web server in a detached docker container:
- Navigate to the directory this package is in.
- Install requirements using pip
pip3 install -r requirements.txt
- Build docker images.
sudo docker-compose build
- Run container.
sudo docker-compose up
The test script does the following steps:
- Checks that port 5000 is available to docker. If not available, exit the program.
- Checks if web_server container is already running on port 5000.
- If web_server container is not running, build the image and run a container.
- Run GET and POST tests from sample-test.sh
- Print test status.
- Navigate to directory this package is in.
- Set appropriate permissions.
sudo chmod a+x ./test.sh
- Run ./test.sh