The official PHP & Apache container by default doesn’t have mod rewrite enabled. To enable this you would need to create your own Dockerfile, using the build “FROM php:xx” where xx is the container you need.
Then add the following line to enable mod rewrite
RUN a2enmod rewrite