If you're installing the IMAP extension in your PHP docker image, it's possible that you get some errors like:
configure: error: utf8_mime2text() has new signature, but U8T_CANONICAL is missing. This should not happen. Check config.log for additional information.
and then:
configure: error: This c-client library is built with Kerberos support.
&& rm -r /var/lib/apt/lists/*
part. Just in case anyone else is unfamiliar with it: You can leave out that part as it isn't related to this issue in particular. You should read about the associated best practices e.g. in the official docs. – Claudioclaudius