Docker compose file is invalid

I’m am trying to create a healthcheck for two of my images at runtime, but when I set up the first one I get:

ERROR: The Compose file ‘./docker-compose.yml’ is invalid because:
Unsupported config option for docker-bench-security: ‘healthcheck’

Below are my images

$ docker build --rm -t docker-bench-security .

Here is my docker-compose.yml

    version: '3.1'

services:

  wordpress:
    image: wordpress
    restart: always
    ports:
      - 8080:80
    environment:
      WORDPRESS_DB_HOST: db
      WORDPRESS_DB_USER: exampleuser
      WORDPRESS_DB_PASSWORD: examplepass
      WORDPRESS_DB_NAME: exampledb

  db:
    image: mysql:5.7
    restart: always
    environment:
      MYSQL_DATABASE: exampledb
      MYSQL_USER: exampleuser
      MYSQL_PASSWORD: examplepass
      MYSQL_RANDOM_ROOT_PASSWORD: '1'
  healthcheck:
   test: ["CMD", "ec2-user_db_1"]

Info from docker ps -a

Image:       Command:                            Name: 
mysql:5.7    "docker-entrypoint.sh mysqld"       ec2-user_db_1
wordpress    "docker-entrypoint.sh apache2-foreground"   ec2-   user_wordpress_1

Any help would be greatly appreciated!

Source: StackOverflow