If you're using Github's workflows for CI/CD and you need to use some of Docker's experimental features, or you want to use buildx or maybe you just want to use some of the new dockerfile experimental syntaxes then you need to enable the experimental features for the CLI and probably the daemon too.

When running natively on Linux or macOS, it's pretty easy.

To enable the experimental features for the CLI, you just need to add the following to your ~/.docker/config.json config:

{
  "experimental": "enabled"
}

NOTE: If you're using the Docker Desktop version, this option might already be available under Preferences > Command Line:

And to enable the experimental features for the daemon, you need to add the following to your /etc/docker/daemon.json config:

{
  "experimental": true
}

NOTE: The above config file path is for docker running on Linux. If you're running docker on macOS, you might find this config at ~/.docker/daemon.json. Or if you're using the Desktop version, you'll find these settings under Preferences > Docker Engine:

The Github workflow setup no different:

name: Stuff builder
on:
  push:
    branches:
      - master

jobs:
  build-stuff:
    runs-on: ubuntu-18.04
    steps:
      - name: Enable experimental features for the Docker daemon and CLI
        run: |
          echo $'{\n  "experimental": true\n}' | sudo tee /etc/docker/daemon.json
          mkdir -p ~/.docker
          echo $'{\n  "experimental": "enabled"\n}' | sudo tee ~/.docker/config.json
          sudo service docker restart
          docker version -f '{{.Client.Experimental}}'
          docker version -f '{{.Server.Experimental}}'
          docker buildx version
.github/workflows/stuffbuilder.yml

That's pretty much it. See it in action at rolandjitsu/docker-ssh.