Docker - docker-compose 'version' doesn't have any configuration options

The reason is you removed the two first lines of the example tutorial your are following, and they do matter.
Because, looking at the docker version you do have you should be on a version of docker-compose higher than 1.6.x.

To identify this, you can run

$ docker-compose -v

In my case that gets me

docker-compose version 1.7.0, build 0d7bf73

If your version there is 1.7.x or higher then the information below definitely apply to you.

This should be working:

version: '2'   ## <- this line matter and you removed it out the tutorial
services:      ## <- this line also
    db:
        image: postgres
    web:
        build: .
        command: bundle exec rails s -p 3000 -b '0.0.0.0'
        volumes:
            - .:/www/html
        ports:
            - "3000:3000"
        depends_on:
            - db

There are currently three versions of the Compose file format:

  1. Version 1, the legacy format. This is specified by omitting a version key at the root of the YAML.
  2. Version 2.x. This is specified with a version: '2' or version: '2.1' entry at the root of the YAML.
  3. Version 3.x, the latest and recommended version, designed to be cross-compatible between Compose and the Docker Engine’s swarm mode. This is specified with a version: '3' or version: '3.1', etc., entry at the root of the YAML.

Additionally, here is a little docker-composeversion / Composer file matrix:

Compose file format Docker Engine release
3.8 19.03.0+
3.7 18.06.0+
3.6 18.02.0+
3.5 17.12.0+
3.4 17.09.0+
3.3 17.06.0+
3.2 17.04.0+
3.1 1.13.1+
3.0 1.13.0+
2.4 17.12.0+
2.3 17.06.0+
2.2 1.13.0+
2.1 1.12.0+
2.0 1.10.0+
1.0 1.9.1.+

Source: https://docs.docker.com/compose/compose-file/compose-versioning/#compatibility-matrix

  • Version 1 is supported by Compose up to 1.6.x. It will be deprecated in a future Compose release.
  • Version 2 files are supported by Compose 1.6.0+ and require a Docker Engine of version 1.10.0+.
  • An upgrade of version 2 that introduces new parameters only available with Docker Engine version 1.12.0+
  • An upgrade of version 2.1 that introduces new parameters only available with Docker Engine version 1.13.0+. This version also allows to specify default scale numbers inside the service’s configuration.
  • Designed to be cross-compatible between Compose and the Docker Engine’s swarm mode, version 3 removes several options and adds several more.

On docker documentation pages there are also now practical guides on how to upgrade your Compose file:

  • One to upgrade from 1 to 2.x
  • One to upgrade from 2.x to 3.x

Additional useful docker Compose documentation:

  • List of all docker-compose versions
  • Compose file version 1
  • Compose file version 2
  • Compose file version 3 (current)

This shows that the version of your docker-compose is of a lesser version. So, if you are on Ubuntu, you can uninstall docker-compose:

sudo apt-get purge docker-compose

Then, you can re-install the latest version with these command:

curl -L "https://github.com/docker/compose/releases/download/1.10.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

Then,

chmod +x /usr/local/bin/docker-compose

In addition to @b.enoit.be answer:

Ubuntu (and probably Debian) users:

Do not use apt docker-compose package!

If you are using it right now:

apt purge docker-compose

It works just fine with their official instructions:

curl -L "https://github.com/docker/compose/releases/download/1.10.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose;
chmod +x /usr/local/bin/docker-compose;
docker-compose --version; // docker-compose version 1.10.0, build 4bd6f1a

You might want to install their official docker-engine too first, if you also used apt packages for this.