I have run into the same error. Here is the log of ssh on DigitalOcean. Please can anyone advice how to resolve this?
@Godwin_Badu-Marfo can you run
curl -i localhost to include the headers sent with the response? That would give us more information.
docker-compose logs service give you any hints? My guess is that you don't have a fully qualified domain pointing to your machine and so certbot is failing.