Because this repository was designed for a lab seminar, code efficiency aspects were not considered.
So, please keep in mind that this is simply a repository for learning 'Docker'.
This script runs a simple web server using 'Flask' and demonstrates a client sending a message to the server.
The server runs in a new thread, while the client sends a message to the server after a certain delay and prints the server's response.
Environment variables are used to set the server's port and the client's message at the time running 'Docker Container'.
USER_NAME variable will be set while building docker-image.
-
Clone the repository
-
Move to
khu-mcl-docker
cd khu-mcl-docker
- Build Docker Image
docker build --build-arg USER_NAME=$USER -t flask_app:latest .
- Run the Container
docker run -p 3000:5000 -e FLASK_PORT=5000 -e CLIENT_MESSAGE="Hello from $USER!" --name flask_server flask_app:latest
- Enter into the Container
docker exec -it flask_server /bin/bash
# Exit Container
exit