Docker Version 20.x and 19.03
If you are using Docker version 20.x you can use Buildx as is.
Below is a sample config to enable set the Remote Docker version, and use `docker buildx build`.
version: 2.1
workflows:
build-deploy:
jobs:
- build
jobs:
build:
docker:
- image: cimg/base:stable
steps:
- setup_remote_docker:
version: 20.10.11
- checkout
- run: docker buildx build .
If you are using Docker version 19.03 , please note that you must enable the "Experimental features" option.
Below is a sample config to showcase how to enable the "Experimental features" option on the remote Docker daemon.
version: 2.1 workflows: build-deploy: jobs: - build jobs: build: docker: - image: cimg/base:stable steps: - setup_remote_docker: version: 19.03.14 - checkout - run: | ssh remote-docker \<<EOF sudo bash -c 'echo "{\"experimental\": true}" > /etc/docker/daemon.json' sudo systemctl restart docker sudo docker info EOF - run: | docker buildx build .
If the above configuration is not working for your image, please try the below configuration:
version: 2.1 workflows: build-deploy: jobs: - build jobs: build: docker: - image: cimg/base:stable steps: - setup_remote_docker: version: 19.03.14 - checkout - run: | export DOCKER_CLI_EXPERIMENTAL=enabled docker buildx build .
There may also be cases where you get the error:
could not create a builder instance with TLS data loaded from environment
To resolve this, please create a context with commands like the following:
docker context create buildx-build docker buildx create --use buildx-build
Please note that if you are using a docker image other than one of our `cimg` images, you will need to make sure that buildx is available within that image.
Comments
Article is closed for comments.