Pre-existing shared memory block (key 5432001, ID 32768) is still in use
It's vital that if you forcibly terminate PostgreSQL then all postgres processes must be killed. If you don't terminate them all then the shared memory block may still be held and the database files may still be open and being written to. In this case starting PostgreSQL again may cause massive database corruption, which is why PostgreSQL tries to stop you doing this. Overriding those safety measures may cause data loss. 

You should preferably cleanly stop PostgreSQL with pg_ctl as part of the container shutdown process.

In any case, it's very important that stopping the container terminates all postgres processes.

You should not delete postmaster.pid, it's protecting you from data corruption by allowing PostgreSQL to notice that the shared memory segment is still in use. Unless Docker somehow gets in the way of this process.