rthewitt/codewars-docker

Container timeouts

Closed this issue · 2 comments

Each docker container should only run for an established maximum time. Docker provides memory and CPU limits but not duration limits OOTB. Related issues raised to Docker indicate that this is considered out of scope. Existing solutions such as:

cont=$(docker run -d "$@")
code=$(timeout "$to" docker wait "$cont" || true)
docker kill $cont &> /dev/null

will not work with the Remote API. The timeout must be present in the bootstrap script, the success of which can be determined by the exit code of the container.

See Docker issue moby/moby#1905

This issue was solved at least a minor release back, using the bootstrap strategy mentioned.