#docker # docker-compose # V1 ```yaml # docker-compose.yml app: build: . ports: - '3000:3000' volumes: - .:/home/web links: - db db: image: 1/postgresql ports: - '5432' volumes_from: - db_data env_file: - $HOME/.docker/$APP/db.env db_data: image: tianon/true volumes: - /var/lib/postgresql ``` ```yaml # config/database.yml development: adapter: postgresql encoding: unicode database: <%= ENV['DB_ENV_DB_NAME'] %> pool: 5 username: <%= ENV['DB_ENV_DB_USER'] %> password: <%= ENV['DB_ENV_DB_PASS'] %> host: <%= ENV['DB_PORT_5432_TCP_ADDR'] %> ``` # V2 Added keys: **services, volumes, networks**. The following keys will be deleted: ***links***. ```yaml # docker-compose.yml version: '2' services: app: build: . ports: - '3000:3000' volumes: - .:/home/web depends_on: - db env_file: - $HOME/.docker/$APP/db.env db: image: sameersbn/postgresql ports: - '5432' volumes: - db_data:/var/lib/postgresql env_file: - $HOME/.docker/$APP/db.env volumes: db_data: ``` ```yaml # config/database.yml development: adapter: postgresql encoding: unicode database: <%= ENV['DB_NAME'] %> pool: 5 username: <%= ENV['DB_USER'] %> password: <%= ENV['DB_PASS'] %> host: <%= ENV['DB_HOST'] %> ``` ```yaml # $HOME/.docker/$APP/db.env DB_NAME=superuser DB_USER=superuser DB_PASS=superuser DB_HOST=db ``` | **What’s Changed** | **Potential Impact** | **Mitigation** | | ---------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------- | | BuildKit support is native within V2 and enabled by default, as it is in the Docker CLI. | Developers on V2 will use BuildKit by default. | Opt out using by setting DOCKER_BUILDKIT=0 | | Container names now use hyphens as separators instead of underscores. | If you rely on container names in scripts, this will cause breaking changes. Generally, we caution against relying on container names. | You can turn this off by passing the flag “–compatibility” |