From version 3.8 of the compose file specification the version key is no longer required. However, it can be kept for information, if so desired.
In order to run 3.8+ Docker Engine 19.03.0+ is required, see the
compatibility matrix
for details.
The latest
Compose file specification
is a merging of the 2.x and 3.x versions and should be the preferred option.