title: Cannot get my docker-compose file to work with roots' bedrock
body: <p>Cheers people ‍♂️</p>
  
  <p>I'm currently working on a wordpress site for a friend. Since I set myself the goal, to only work with docker locally, I tried to dockerize my setup.
  The setup is based on roots' bedrock &amp; sage systems.</p>
  
  <p>Since there already is a wordpress docker-compose (provided by wordpress), I used this a the base for my docker-compose file, edited the appropriate data &amp; started using it.</p>
  
  <p>I can seem to get to my wp instance. So no problem here. Unfortunately, I'm not able to connect to the database container from my wp container.</p>
  
  <p>I've tried to change env vars, ports/links in the docker-compose file but nothing seems to work.</p>
  
  <pre><code># the compose file
  ---
    version: "3"
  
    services:
      wordpress-db:
        image: mariadb:latest
        volumes:
          - wordpress-db-data:/var/lib/mysql
        restart: always
        environment:
          MYSQL_ROOT_PASSWORD: somewordpress
          MYSQL_DATABASE: wordpress
          MYSQL_USER: wordpress
          MYSQL_PASSWORD: wordpress
        container_name: wordpress-db
        ports:
          - '3306:3306'
  
      wordpress-wp:
        depends_on:
          - wordpress-db
        image: wordpress:latest
        links:
          - wordpress-db
        volumes:
          - ./web:/var/www/html
          - ./config:/var/www/config
          - ./vendor:/var/www/vendor
          - ./.env:/var/www/.env
          - ./composer.json:/var/www/composer.json
          - ./wp-cli.yml:/var/www/wp-cli.yml
        ports:
        - '80:80'
        restart: always
        container_name: wordpress-wp
    volumes:
      wordpress-db-data:
        driver: local
  </code></pre>
  
  <pre class="lang-sh prettyprint-override"><code># the env file
  DB_NAME=wordpress
  DB_USER=wordpress
  DB_PASSWORD=wordpress
  
  # Optionally, you can use a data source name (DSN)
  # When using a DSN, you can remove the DB_NAME, DB_USER, DB_PASSWORD, and DB_HOST variables
  DATABASE_URL=mysql://wordpress:wordpress@localhost:3306/wordpress
  
  # Optional variables
  # DB_HOST=
  # DB_PREFIX=wp_
  
  WP_ENV=development
  WP_HOME=localhost
  WP_SITEURL=${WP_HOME}/wp
  
  # Generate your keys here: https://roots.io/salts.html
  AUTH_KEY='6&amp;J&amp;.WDf,VGfb!i@2B6TW-294-R|B?dZ1K1b7_Ms&lt;Dbu9a9-Iud&lt;B$*LC1{lU)m!'
  SECURE_AUTH_KEY='#MgCVGx.KWV6R*lk:esocM5f#qucQ&gt;N4gq#|`pdgI+ROF&lt;b6|Q8K!.Yu6jXI@I!p'
  LOGGED_IN_KEY='#dOrYLz[JlxSwlWgY6oE:0/(6fsxL_x$6amRw?A:i(oaUK]U+W5S!z%CgiA,B[T3'
  NONCE_KEY='A8Dl3^6H6p=q1jR/(m1HLR|^k-A}WGiR$Q!bbfu.`|udsNr&gt;s?bMV^L+mWYY?*5Z'
  AUTH_SALT='9&lt;(xi|RS.+x0h6z+XbErRKoQlE1wG`X&gt;)!xb5zW1}dZPQ$,+OS[Z_ev2KdZSOjR0'
  SECURE_AUTH_SALT='tj(#5`or}_Afs.lZOT@4NdTaNU!s+Y0e=4oWHywgVi9B.U6vo*Y5$s;f`&gt;WwGx}L'
  LOGGED_IN_SALT='tw*Wcin=d8T.7w+)$oei:?|clZ1;-hCc||KgI[Zm[P*O+i4YE9_7:|^6_&amp;AnpYyN'
  NONCE_SALT='PPjSg+}.N5u&amp;zfex[o[9&lt;3m6dWSQFWeSW00;;B5E(Dn{nLFZ:k)MzVbjsUC5E0|$'
  </code></pre>
  
  <pre class="lang-sh prettyprint-override"><code># the folder structure
  .
  ├── CHANGELOG.md
  ├── LICENSE.md
  ├── README.md
  ├── composer.json
  ├── composer.lock
  ├── config
  │   ├── application.php
  │   └── environments
  ├── docker-compose.dev.yml
  ├── docker-compose.yml
  ├── vendor
  │   ├── autoload.php
  │   ├── bin
  │   ├── composer
  │   ├── oscarotero
  │   ├── phpoption
  │   ├── roots
  │   ├── squizlabs
  │   ├── symfony
  │   └── vlucas
  ├── web
  │   ├── app
  │   ├── index.php
  │   ├── wp
  │   └── wp-config.php
  └── wp-cli.yml
  </code></pre>
  
  <p>I expect this to actually work. Unfortunately, WordPress (on localhost) tells me, that there's an 'Error establishing a database connection'.
  Here's a screenshot:
  <a href="https://d.pr/i/hZrDUk" rel="nofollow noreferrer">https://d.pr/i/hZrDUk</a></p>
  
  <p>This is the terminal output when starting the containers:</p>
  
  <pre class="lang-sh prettyprint-override"><code>➜  mb-wp git:(master) ✗ docker-compose -f docker-compose.dev.yml up --force-recreate --build
  Creating volume "mb-wp_wordpress-db-data" with local driver
  Creating wordpress-db ... done
  Creating wordpress-wp ... done
  Attaching to wordpress-db, wordpress-wp
  wordpress-db    | Initializing database
  wordpress-wp    | AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 192.168.112.3. Set the 'ServerName' directive globally to suppress this message
  wordpress-wp    | AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 192.168.112.3. Set the 'ServerName' directive globally to suppress this message
  wordpress-wp    | [Mon Jul 08 08:14:42.817813 2019] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.25 (Debian) PHP/7.3.6 configured -- resuming normal operations
  wordpress-wp    | [Mon Jul 08 08:14:42.817965 2019] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
  wordpress-db    | 
  wordpress-db    | 
  wordpress-db    | PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER !
  wordpress-db    | To do so, start the server, then issue the following commands:
  wordpress-db    | 
  wordpress-db    | '/usr/bin/mysqladmin' -u root password 'new-password'
  wordpress-db    | '/usr/bin/mysqladmin' -u root -h  password 'new-password'
  wordpress-db    | 
  wordpress-db    | Alternatively you can run:
  wordpress-db    | '/usr/bin/mysql_secure_installation'
  wordpress-db    | 
  wordpress-db    | which will also give you the option of removing the test
  wordpress-db    | databases and anonymous user created by default.  This is
  wordpress-db    | strongly recommended for production servers.
  wordpress-db    | 
  wordpress-db    | See the MariaDB Knowledgebase at http://mariadb.com/kb or the
  wordpress-db    | MySQL manual for more instructions.
  wordpress-db    | 
  wordpress-db    | Please report any problems at http://mariadb.org/jira
  wordpress-db    | 
  wordpress-db    | The latest information about MariaDB is available at http://mariadb.org/.
  wordpress-db    | You can find additional information about the MySQL part at:
  wordpress-db    | http://dev.mysql.com
  wordpress-db    | Consider joining MariaDB's strong and vibrant community:
  wordpress-db    | https://mariadb.org/get-involved/
  wordpress-db    | 
  wordpress-db    | Database initialized
  wordpress-db    | MySQL init process in progress...
  wordpress-db    | 2019-07-08  8:14:44 0 [Note] mysqld (mysqld 10.4.6-MariaDB-1:10.4.6+maria~bionic) starting as process 106 ...
  wordpress-db    | 2019-07-08  8:14:44 0 [Note] InnoDB: Using Linux native AIO
  wordpress-db    | 2019-07-08  8:14:44 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
  wordpress-db    | 2019-07-08  8:14:44 0 [Note] InnoDB: Uses event mutexes
  wordpress-db    | 2019-07-08  8:14:44 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
  wordpress-db    | 2019-07-08  8:14:44 0 [Note] InnoDB: Number of pools: 1
  wordpress-db    | 2019-07-08  8:14:44 0 [Note] InnoDB: Using SSE2 crc32 instructions
  wordpress-db    | 2019-07-08  8:14:44 0 [Note] mysqld: O_TMPFILE is not supported on /tmp (disabling future attempts)
  wordpress-db    | 2019-07-08  8:14:44 0 [Note] InnoDB: Initializing buffer pool, total size = 256M, instances = 1, chunk size = 128M
  wordpress-db    | 2019-07-08  8:14:44 0 [Note] InnoDB: Completed initialization of buffer pool
  wordpress-db    | 2019-07-08  8:14:44 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
  wordpress-db    | 2019-07-08  8:14:44 0 [Note] InnoDB: 128 out of 128 rollback segments are active.
  wordpress-db    | 2019-07-08  8:14:44 0 [Note] InnoDB: Creating shared tablespace for temporary tables
  wordpress-db    | 2019-07-08  8:14:44 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
  wordpress-db    | 2019-07-08  8:14:44 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
  wordpress-db    | 2019-07-08  8:14:44 0 [Note] InnoDB: Waiting for purge to start
  wordpress-db    | 2019-07-08  8:14:44 0 [Note] InnoDB: 10.4.6 started; log sequence number 139827; transaction id 21
  wordpress-db    | 2019-07-08  8:14:44 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
  wordpress-db    | 2019-07-08  8:14:44 0 [Note] Plugin 'FEEDBACK' is disabled.
  wordpress-db    | 2019-07-08  8:14:44 0 [Note] InnoDB: Buffer pool(s) load completed at 190708  8:14:44
  wordpress-db    | 2019-07-08  8:14:44 0 [Warning] 'user' entry 'root@ed060ae69169' ignored in --skip-name-resolve mode.
  wordpress-db    | 2019-07-08  8:14:44 0 [Warning] 'user' entry '@ed060ae69169' ignored in --skip-name-resolve mode.
  wordpress-db    | 2019-07-08  8:14:44 0 [Warning] 'proxies_priv' entry '@% root@ed060ae69169' ignored in --skip-name-resolve mode.
  wordpress-db    | 2019-07-08  8:14:44 0 [Note] Reading of all Master_info entries succeeded
  wordpress-db    | 2019-07-08  8:14:44 0 [Note] Added new Master_info '' to hash table
  wordpress-db    | 2019-07-08  8:14:44 0 [Note] mysqld: ready for connections.
  wordpress-db    | Version: '10.4.6-MariaDB-1:10.4.6+maria~bionic'  socket: '/var/run/mysqld/mysqld.sock'  port: 0  mariadb.org binary distribution
  wordpress-db    | Warning: Unable to load '/usr/share/zoneinfo/leap-seconds.list' as time zone. Skipping it.
  wordpress-db    | 2019-07-08  8:14:58 10 [Warning] 'proxies_priv' entry '@% root@ed060ae69169' ignored in --skip-name-resolve mode.
  wordpress-db    | 
  wordpress-db    | 2019-07-08  8:14:58 0 [Note] mysqld (initiated by: unknown): Normal shutdown
  wordpress-db    | 2019-07-08  8:14:58 0 [Note] Event Scheduler: Purging the queue. 0 events
  wordpress-db    | 2019-07-08  8:14:58 0 [Note] InnoDB: FTS optimize thread exiting.
  wordpress-db    | 2019-07-08  8:14:58 0 [Note] InnoDB: Starting shutdown...
  wordpress-db    | 2019-07-08  8:14:58 0 [Note] InnoDB: Dumping buffer pool(s) to /var/lib/mysql/ib_buffer_pool
  wordpress-db    | 2019-07-08  8:14:58 0 [Note] InnoDB: Buffer pool(s) dump completed at 190708  8:14:58
  wordpress-db    | 2019-07-08  8:14:59 0 [Note] InnoDB: Shutdown completed; log sequence number 139836; transaction id 24
  wordpress-db    | 2019-07-08  8:14:59 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
  wordpress-db    | 2019-07-08  8:14:59 0 [Note] mysqld: Shutdown complete
  wordpress-db    | 
  wordpress-db    | 
  wordpress-db    | MySQL init process done. Ready for start up.
  wordpress-db    | 
  wordpress-db    | 2019-07-08  8:14:59 0 [Note] mysqld (mysqld 10.4.6-MariaDB-1:10.4.6+maria~bionic) starting as process 1 ...
  wordpress-db    | 2019-07-08  8:14:59 0 [Note] InnoDB: Using Linux native AIO
  wordpress-db    | 2019-07-08  8:14:59 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
  wordpress-db    | 2019-07-08  8:14:59 0 [Note] InnoDB: Uses event mutexes
  wordpress-db    | 2019-07-08  8:14:59 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
  wordpress-db    | 2019-07-08  8:14:59 0 [Note] InnoDB: Number of pools: 1
  wordpress-db    | 2019-07-08  8:14:59 0 [Note] InnoDB: Using SSE2 crc32 instructions
  wordpress-db    | 2019-07-08  8:14:59 0 [Note] mysqld: O_TMPFILE is not supported on /tmp (disabling future attempts)
  wordpress-db    | 2019-07-08  8:14:59 0 [Note] InnoDB: Initializing buffer pool, total size = 256M, instances = 1, chunk size = 128M
  wordpress-db    | 2019-07-08  8:14:59 0 [Note] InnoDB: Completed initialization of buffer pool
  wordpress-db    | 2019-07-08  8:14:59 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
  wordpress-db    | 2019-07-08  8:14:59 0 [Note] InnoDB: 128 out of 128 rollback segments are active.
  wordpress-db    | 2019-07-08  8:14:59 0 [Note] InnoDB: Creating shared tablespace for temporary tables
  wordpress-db    | 2019-07-08  8:14:59 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
  wordpress-db    | 2019-07-08  8:14:59 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
  wordpress-db    | 2019-07-08  8:14:59 0 [Note] InnoDB: 10.4.6 started; log sequence number 139836; transaction id 21
  wordpress-db    | 2019-07-08  8:14:59 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
  wordpress-db    | 2019-07-08  8:14:59 0 [Note] Plugin 'FEEDBACK' is disabled.
  wordpress-db    | 2019-07-08  8:15:00 0 [Note] Server socket created on IP: '::'.
  wordpress-db    | 2019-07-08  8:15:00 0 [Note] InnoDB: Buffer pool(s) load completed at 190708  8:14:59
  wordpress-db    | 2019-07-08  8:15:00 0 [Warning] 'proxies_priv' entry '@% root@ed060ae69169' ignored in --skip-name-resolve mode.
  wordpress-db    | 2019-07-08  8:15:00 0 [Note] Reading of all Master_info entries succeeded
  wordpress-db    | 2019-07-08  8:15:00 0 [Note] Added new Master_info '' to hash table
  wordpress-db    | 2019-07-08  8:15:00 0 [Note] mysqld: ready for connections.
  wordpress-db    | Version: '10.4.6-MariaDB-1:10.4.6+maria~bionic'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  mariadb.org binary distribution
  wordpress-wp    | [Mon Jul 08 08:16:40.801399 2019] [php7:warn] [pid 17] [client 192.168.112.1:47502] PHP Warning:  mysqli_real_connect(): (HY000/2002): No such file or directory in /var/www/html/wp/wp-includes/wp-db.php on line 1612
  wordpress-wp    | 192.168.112.1 - - [08/Jul/2019:08:16:40 +0000] "GET / HTTP/1.1" 200 1737 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36"
  </code></pre>