Unable to use Docker --ssh flag with Elastic Stack

We’ve deployed Elastic Stack 5.0.0 with Docker 19.03.13 (verified) and enabled the experimental Docker functionality.

We’re trying to use the --ssh default flag in our custom plugin to allow use of the SSH agent on the host. Docker however appears to be ignoring our specifying DOCKER_BUILDKIT=1 before running Docker, as well as ignoring it being specified in the pipeline’s environment. This results in the error unknown flag: --ssh default

How do we enable Docker’s Buildkit with the Elastic CI Stack?

Hi @troyfontaine_mogo,

Interesting, we use Docker Buildkit to build and deploy Buildkite from an Elastic CI stack. I don’t think we did anything special to turn on Buildkit, I’m pretty sure it’s available by default in the latest Docker releases.

Are you using the docker and docker-compose buildkite plugins at all, or only a custom plugin?

The docker plugin should use buildkit if you add DOCKER_BUILDKIT=1 to your build step.

For docker-compose you’ll need both DOCKER_BUILDKIT=1 and COMPOSE_DOCKER_CLI_BUILD=1 as described in this issue:

If you’re running docker commands yourself then I’m not sure. We do have one pipeline which uses the ssh provider, and we run it like this:

DOCKER_BUILDKIT=1 docker build --progress=plain --ssh=default -t "$REPOSITORY:$TAG" .

How are you invoking Docker?

Found the problem, your example made it clear as day (THANK YOU!!!). Locally I can configure the flag as --ssh default but on the buildkite hosts I have to specify it as --ssh=default.

Now I’m just trying to chase down an error from Buildkit about failed to solve with frontend dockerfile.v0: failed to create LLB definition: Dockerfile parse error line 21: Unknown flag: mount

I’ve now appended # syntax=docker/dockerfile:experimental to the beginning of the Dockerfile and will run a test once I can push the latest change to Github.

1 Like

That did it! It works beautifully now. Thank you for all your help!

1 Like