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
    - master
  - 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 | sudo apt-key add -
  - sudo add-apt-repository "deb [arch=amd64] $(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 "" > ~/.docker/cli-plugins/docker-buildx
  - chmod a+x ~/.docker/cli-plugins/docker-buildx
    - stage: build and push docker image
        - 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 "" > ~/.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.



1 Like