Trying to create a collation on Postgres 9.6; a nonsensical error message I'm running Postgres 9.6.1 on a Debian-based Docker image. My default locale is en_US.utf8. I'm trying to create a collation of type ja_JP.utf8. I have the Japanese locale installed as demonstrated by the command locale -a:

$ locale -a
C
C.UTF-8
en_US.utf8
ja_JP.utf8
POSIX


However, when trying to create the Japanese collation in psql, I get the following, nonsensical error message:

# create collation ja_JP (LOCALE="ja_JP.utf8");
ERROR:  could not create locale "ja_JP.utf8": Success


Googling a bit finds me a bug report from over two years back: https://www.postgresql.org/message-id/20140525154511.GA21233%40alap3.anarazel.de

It looks the same, and judging from my symptoms, it isn't fixed yet! Is there any way to work around this bug?
I found a workaround: the bug happens only if an earlier attempt to create a collation has failed. After a failure, the bug seems to keep happening until the server process is restarted. So to create the collation, you have to get it right from the start, or restart the process to try again. To restart a Docker container, use

docker restart $DB_CONTAINER_NAME_HERE