'How to print the final version of `docker-compose.yml` with .env variables replaced?

I have a docker-compose.yml file which uses a few variables set in an .env file.

Is there an easy way to print the final version of the file, to check if everything was correctly replaced?

# .env
UBUNTU_VERSION=19.8

.

# docker-compose.yml

version: '3'

services:
  myservice:
    image: ubuntu:${UBUNTU_VERSION}
    env-file:
      - .env

Note:

Compose supports declaring default environment variables in an environment file named .env placed in the folder where the docker-compose

Documentation: https://docs.docker.com/compose/env-file/



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source