Docker:dind based build is painfully slow

I am running 8.15 with the latest gitlab-runner. When I run a docker build via CI it takes 58 minutes to complete. Even ‘ARG’ lines take several minutes to process. When I manually run docker build on the same host it completes in 5 minutes.

If it helps, my .gitlab-ci.yml file looks like this:

build_image:
image: docker:git
services:

  • docker:dind
    script:
    • docker build
      –build-arg FB_APP_ID="$FB_APP_ID"
      –build-arg FB_APP_SECRET="$FB_APP_SECRET"
      –build-arg GITHUB_APP_ID="$GITHUB_APP_ID"
      –build-arg GITHUB_APP_SECRET="$GITHUB_APP_SECRET"
      –build-arg GITLAB_APP_ID="$GITLAB_APP_ID"
      –build-arg GITLAB_APP_SECRET="$GITLAB_APP_SECRET"
      –build-arg GOOGLE_APP_ID="$GOOGLE_APP_ID"
      –build-arg GOOGLE_APP_SECRET="$GOOGLE_APP_SECRET"
      –build-arg TWITTER_APP_ID="$TWITTER_APP_ID"
      –build-arg TWITTER_APP_SECRET="$TWITTER_APP_SECRET"
      -t $CI_REGISTRY/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME:$CI_BUILD_REF_NAME .
    • docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
    • docker push $CI_REGISTRY/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME:$CI_BUILD_REF_NAM

Any help would be appreciated. Thanks.

Wow. I switched to using the overlay driver and now it’s MUCH faster.