services: yourls: image: yourls:1.10.6-apache restart: unless-stopped environment: YOURLS_SITE: ${URL} YOURLS_USER: ${ADMIN_USERNAME} YOURLS_PASS: ${ADMIN_PASSWORD} YOURLS_COOKIEKEY: ${COOKIE_KEY} YOURLS_DB_HOST: db YOURLS_DB_USER: yourls YOURLS_DB_PASS: ${DB_PASSWORD} YOURLS_DB_NAME: yourls # The image runs the PHP files of /docker-entrypoint-init.d before Apache starts: this one # waits for the database and makes YOURLS's tables, which its install page would otherwise # leave to a visitor's click. command: - sh - -c - | mkdir -p /docker-entrypoint-init.d cat > /docker-entrypoint-init.d/install.php <<'PHP'