ERROR: In file './docker-compose.yml', volume must be a mapping not a string
<p><strong>Question:</strong>
Why do I get this error?</p>
<blockquote>
<p>ERROR: In file './docker-compose.yml', volume 'mariavolume' must be a mapping not a string.</p>
</blockquote>
<p>My docker-compose file is almost identical to this one: <a href="https://docs.docker.com/compose/wordpress/" rel="nofollow noreferrer">https://docs.docker.com/compose/wordpress/</a></p>
<pre class="lang-yaml prettyprint-override"><code>version: '2'
services:
  wordpress:
    image: wordpress:latest
    restart: always
    depends_on:
      - db
    ports:
      - 8080:80
    environment:
      WORDPRESS_DB_PASSWORD: example
      WORDPRESS_DB_HOST: 3306
  db:
    image: mariadb
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: example
    volumes:
      - maria_volume: /var/lib/mysql
volumes:
  maria_volume: ~/mariadb
</code></pre>