Agree, I missed these parts. Few words about restarts:
- If CoD2 would stop for some reason (e.g. ShutdownGame, as Damage said) - Docker will restart it automatically ('restart' part in docker-compose.yml)
- If for some reason CoD2 would still run, but health check (you can look that part in Dockerfile. it's just a getinfo from the server, which takes each 5 seconds 3 times) would fail (e.g. server just freezed) - docker container would be marked as 'unhealthy'. But! In this case, the container wouldn't restart automatically - there is no such functionality in Docker. In this case you should use some tool, which would process it. For my server I use a docker image called autoheal. An example of my docker-compose.yml for autoheal:
AUTOHEAL_CONTAINER_LABEL with value "all" means that all unhealthy containers would be restarted.Code:version: '3.7' services: autoheal: image: willfarrell/autoheal container_name: autoheal restart: always volumes: - /var/run/docker.sock:/var/run/docker.sock environment: AUTOHEAL_CONTAINER_LABEL: "all"
So, your server should be up even after freeze or something like.
About logging:
As I said before, you always can look a full log via 'docker logs <container id>'. But if you also want to see a log file, you can find it here:
/var/lib/docker/containers/<container id>/<container id>-json.log
I pinned this answer to the head, in Advanced part.