Question: I need a way to automatically find out SSH username for an instance. It requires knowing whether AMI is Amazon Linux or Ubuntu (ec2-user@ for Amazon Linux vs ubuntu@ on Ubuntu images)

Can someone see a way to get this info?

I've been using `image.root_device_name` which seems to be `/dev/xvda` on Amazon Linux `/dev/sda1` on Ubuntu, but I wonder how reliable this is and if there's an alternative way.

Answer: 
In the same directory as `docker-compose.yml` add an environment file named `.env`, then specify your environment variable. 

[![enter image description here](https://i.stack.imgur.com/AAGRu.png)](https://i.stack.imgur.com/AAGRu.png)

After that, add variable into your `docker-compose.yml`

[![enter image description here](https://i.stack.imgur.com/JT76j.png)](https://i.stack.imgur.com/JT76j.png)

The `${..}` represents a variable in `.env`
Docker-compose used Interpolation Syntax `${variable}` for variables and you missed that in your file. 

```
version: '2'

services:
  db:
    image: example/db:${version}
  backend:
    image: example/server:${version}
  frontend:
    image: example/gui:${version}

```

So just pass the version to your `docker-compose` command

```
version=1.13-alpine docker-compose up

```