Docker buildx problems

Hey Travis community,

Tying to build image for platform ppc64le via Docker buildx and Buildkit on our enterprise Travis CI instance.

Here’s our .travis.yml

os: linux
dist: bionic
language: shell
branches:
  only:
    - master
before_install:
  - set -e
  # Configure environment so changes are picked up when the Docker daemon is restarted after upgrading
  - echo '{"experimental":true}' | sudo tee /etc/docker/daemon.json
  - export DOCKER_CLI_EXPERIMENTAL=enabled
  - sudo rm -rf /var/lib/apt/lists/*
  - curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
  - sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) edge"
  - sudo apt-get update
  - sudo apt-get -y -o Dpkg::Options::="--force-confnew" install docker-ce
  - mkdir -vp ~/.docker/cli-plugins/
  - curl --silent -L "https://github.com/docker/buildx/releases/download/v0.3.0/buildx-v0.3.0.linux-amd64" > ~/.docker/cli-plugins/docker-buildx
  - chmod a+x ~/.docker/cli-plugins/docker-buildx
jobs:
  include:
    - stage: build and push docker image
      script:
        - echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin  
        - sudo docker buildx build --platform linux/ppc64le --tag myimage:ppc64le -f src/main/docker/Dockerfile.ppc64 --push .

Build will fail on error: # if not instated on dockerfile

$ sudo docker buildx build --platform linux/ppc64le --tag myimage:ppc64le -f src/main/docker/Dockerfile.ppc64 --push .
unknown flag: --platform
See 'docker --help'.
Usage:  docker [OPTIONS] COMMAND

buildx is not embedded, but experimental_cli is, so kind of stuck… Any ideas about how to enable buildx on Travis CI?

From what I can see you are missing this in your before_install Travis hook for this multiarch build:

  - mkdir -vp ~/.docker/cli-plugins/
  - curl --silent -L "https://github.com/docker/buildx/releases/download/v0.3.0/buildx-v0.3.0.linux-amd64" > ~/.docker/cli-plugins/docker-buildx
  - chmod a+x ~/.docker/cli-plugins/docker-buildx

Using cURL and making sure docker-buildx has proper persmissions is key here, so that’s why there’s chmod. See if this works, I’m almost for certain it will work for your Docker buildx problem.

Hey great this solved your issue @SolarUltima, any other info you can give us on the success? As it helps the whole community.

Thanks,

Montana.