Can't use an older version of postgres

I have created a docker-compose.yml in which I try to specify an older version of postgres.

The first few lines of the yaml file are:

version: “3”
services:
db:
image: postgres:9.6

When I build the ‘db’ container I see the following:

docker-compose build --no-cache db
Building db
Step 1/7 : FROM postgres:12.0
—> f88dfa384cc4

It is getting postgres version 12 rather than 9.6 as I specified.

What am I doing wrong?

thanks

Do you have a Dockerfile to build the image for this service?