Docker
Method 1 - WebGoat and WebWolf All-in-One Image
The easiest way to start WebGoat as a Docker container is to use the All-in-One WebGoat image which contains both WebGoat and WebWolf as well as an NGINX reverse proxy.
- Run the following command to download the All-in-One image from DockerHub, and consequently install and execute both WebGoat and WebWolf. 
docker run -it -p 127.0.0.1:8080:8080 -p 127.0.0.1:9090:9090 -e TZ=Europe/Amsterdam webgoat/webgoatMethod 2 - WebGoat and WebWolf Docker Compose
Another way to deply WebGoat and WebWolf in a more advanced way is to use a compose-file such as the docker-compose.yml file from the WebGoat Github repository. This will start both containers and it also takes care of setting up the connection between WebGoat and WebWolf.
- Create folder WASE in your laptop / PC and go into that folder. 
- Run the following command from the folder WASE. 
curl https://raw.githubusercontent.com/WebGoat/WebGoat/develop/docker-compose.yml | docker-compose -f - upUsing the docker-compose file will simplify getting WebGoat and WebWolf up and running.
How Docker and WebGoat Work Together?
- Docker Container: - When you run - docker run -d -p 8080:8080 webgoat/webgoat-8.0, Docker creates a container from the WebGoat image. This container is a lightweight, standalone, and executable package that includes everything needed to run the application, including the code, runtime, libraries, and dependencies.
 
- Port Mapping: - The - -p 8080:8080flag in the Docker command maps port 8080 on your host machine (Windows 11) to port 8080 in the Docker container where WebGoat is running.
- This means that any network traffic sent to port 8080 on your host machine is forwarded to port 8080 inside the container. 
 
- Web Server: - Inside the Docker container, WebGoat runs a web server that listens for HTTP requests on port 8080. 
 
Accessing WebGoat in a Browser
- Open a Web Browser: - Launch your preferred web browser (e.g., Chrome, Firefox, Edge). 
 
- Enter the URL: - Type - http://localhost:8080/WebGoatin the address bar and press Enter.
- localhostrefers to your local machine, and- 8080is the port that Docker is forwarding to the WebGoat container.
 
Communication Flow
- Browser Request: - When you enter the URL and press Enter, your browser sends an HTTP request to - http://localhost:8080/WebGoat.
 
- Docker Port Forwarding: - Docker receives the request on port 8080 of your host machine. 
- Docker forwards this request to port 8080 inside the WebGoat container. 
 
- WebGoat Server: - The WebGoat server running inside the container receives the request. 
- WebGoat processes the request and generates a response (e.g., an HTML page). 
 
- Response to Browser: - The WebGoat server sends the response back to Docker. 
- Docker forwards the response from port 8080 in the container to port 8080 on your host machine. 
- Your browser receives the response and renders the WebGoat application. 
 
Visual Representation
Here's a visual representation of the communication flow:

Last updated
Was this helpful?
