The Microsoft employee Daniel Meixner (Blog, Twitter) had created a debug container. It is based on NodeJS and provides some calls. For example, the call / provides information about the container itself and displays the provided parameters. The function /api/cascade calls another container configured as a parameter. The details about the calls are in the readme of the Github repository:

The extension

For further tests I needed a variable call of different containers at the cascade call. This allows a more complex network of services to be simulated. I rebuilt the cascade part so the configuration takes multiple IP addresses (including port and path) and randomly calls one of them. The syntax is JSON and the new parameter CASCADECONFIG replaces the 3 old parameters of Daniel (SERVICEENDPOINTHOST, SERVICEENDPOINTPATH, SERVICEENDPOINTPORT).

... CASCADECONFIG='[{"ip":"","port":"80","path":"/"},{"ip":"", "port":"80", "path":"/ping"}]' ...

Another adaptation is the simulation of errors. Here, an error rate can be specified in the ERRORRATE variable, for example a 4, which causes every fourth call to fail. An error rate of 0 never generates incorrect calls and an error rate of 1 generates an error with each call. However, the error is only generated for the functions /ping and /. The call /api/whoareu is always error-free and the call /api/cascade returns the status code of the calling function. The error to be generated is specified in the ERROROCDE variable, for example 404, to simulate a File Not Found.

... -e ERRORRATE=8 -e ERRORCODE=404 ...

To build the environment shown above in the a local docker, the calls could look like this:

docker run -p 8083:80 -e COLOR=red -e ERRORRATE=4 -e ERRORCODE=405 tzuehlke/dbgc
docker run -p 8082:80 -e COLOR=tomato -e ERRORRATE=8 -e ERRORCODE=404 tzuehlke/dbgc
docker run -p 8081:80 -e COLOR=yellow -e CASCADECONFIG='[{"ip":"","port":"80","path":"/"},{"ip":"", "port":"80", "path":"/ping"}]' tzuehlke/dbgc
docker run -p 8080:80 -e COLOR=green -e CASCADECONFIG='[{"ip":"","port":"80","path":"/api/cascade"}]' tzuehlke/dbgc

and then created the following result and behavior:

SSH Server

Also, it is often useful to have an SSH server to connect to the container. Therefore, the Dockerfile contains the appropriate installation according to the Microsoft documentation, which configures a server on port 2222. Port 2222 is required for App Services because only this port can be used for the SSH shell in the Azure portal. The call for the local docker container must therefore contain the port mapping to 2222:

docker run -it -p 22:2222 ...