Slackbot
10/28/2022, 7:34 AMEric Riddoch
10/28/2022, 7:36 AM+ DOCKER_BUILDKIT=1
+ bentoml containerize keras-ctr-service:latest --docker-image-tag keras-ctr-service:latest
Here is the error I'm getting:
WARNING: You are using pip version 22.0.4; however, version 22.3 is available.
You should consider upgrading via the '/opt/atlassian/pipelines/agent/build/venv-containerize-service/bin/python -m pip install --upgrade pip' command.
Error: [bentoml-cli] `containerize` failed: BentoML requires BuildKit (via Docker Buildx) to be installed to support multi-arch builds. Buildx comes with Docker Desktop, but one can also install it manually by following instructions via <https://docs.docker.com/buildx/working-with-buildx/#install>.
error: Recipe `containerize-bento-service` failed with exit code 1
error: Recipe `containerize-bento-service-cd` failed with exit code 1Eric Riddoch
10/28/2022, 7:38 AMDOCKER_BUILDKIT=1 to the bentoml containerize ... command, and I included the docker service.Eric Riddoch
10/28/2022, 7:42 AMbitbucket-pipelines.yml to what I'm runningEric Riddoch
10/28/2022, 7:55 AMbento-cli runs docker buildx --help to check whether buildkit is installed. It asserts that the string "buildx" is in the output. We can see that it indeed is not in the output in bitbucket pipelines.Eric Riddoch
10/28/2022, 8:44 AMbuildx into the docker plugins directory in bitbucket by following the docker/buildx installation guide. So I added this step to my pipeline file:
- |
export BUILDKIT_FPATH=$HOME/.docker/cli-plugins/docker-buildx
mkdir -p /root/.docker/cli-plugins
wget <https://github.com/docker/buildx/releases/download/v0.9.1/buildx-v0.9.1.linux-amd64> -O $BUILDKIT_FPATH
chmod +x $BUILDKIT_FPATH
But I got a new error instead. It looks like docker build is somehow trying to build the container with --privileged true.
+ npx just containerize-bento-service-cd
/tmp/justGgW4wU/containerize-bento-service-cd: line 126: deactivate: command not found
not in venv
WARNING: You are using pip version 22.0.4; however, version 22.3 is available.
You should consider upgrading via the '/opt/atlassian/pipelines/agent/build/venv-containerize-service/bin/python -m pip install --upgrade pip' command.
+ DOCKER_BUILDKIT=1
+ bentoml containerize keras-ctr-service:latest --docker-image-tag keras-ctr-service:latest
Building docker image for Bento(tag="keras-ctr-service:htaqimcwtsdanvxg")...
#1 [internal] booting buildkit
#1 pulling image moby/buildkit:buildx-stable-1
#1 pulling image moby/buildkit:buildx-stable-1 3.9s done
#1 creating container buildx_buildkit_default 0.0s done
#1 ERROR: Error response from daemon: authorization denied by plugin pipelines: --privileged=true is not allowed
------
> [internal] booting buildkit:
------
ERROR: Error response from daemon: authorization denied by plugin pipelines: --privileged=true is not allowed
Failed building docker image: Command '['docker', 'buildx', 'build', '--progress', 'auto', '--tag', 'keras-ctr-service:latest', '--file', 'env/docker/Dockerfile', '--load', '.']' returned non-zero exit status 1.
error: Recipe `containerize-bento-service` failed with exit code 1
error: Recipe `containerize-bento-service-cd` failed with exit code 1Eric Riddoch
10/28/2022, 8:45 AMEric Riddoch
10/28/2022, 8:56 AMdocker buildx is intentionally restriccted: https://support.atlassian.com/bitbucket-cloud/docs/run-docker-commands-in-bitbucket-pipelines/#Docker-BuildKit-restrictionsEric Riddoch
10/28/2022, 8:57 AMbentoml containerize which I imagine is a big deal for unfortunate companies like us who use Bitbucket and Bitbucket Pipelines for CI/CD, including the building of all production docker images.Aaron Pham
10/28/2022, 1:05 PMAaron Pham
10/28/2022, 1:17 PMdocker build by passing DOCKER_BUILDKIT=1. I believe that we can still use buildkit without having to use docker buildx.
In terms of CI story, buildx only fully support GitHub Actions πShihgian Lee
10/28/2022, 1:25 PMEric Riddoch
10/28/2022, 3:51 PMShihgian Lee
10/28/2022, 5:28 PMTim Liu
10/28/2022, 7:23 PMTim Liu
10/28/2022, 7:31 PMDOCKER_BUILDKIT=1
@Aaron Pham Does that seem right? (Given Eric's observation that we may use docker buildx to check if buildkit is present?)
Just FYI for everyone, looks like Bitbucket doesn't support buildx because of this bug as noted here
All that said, we need to make the experience better out of the box especially in cases where you may not have buildx/buildkitEric Riddoch
10/28/2022, 7:32 PMAaron Pham
10/28/2022, 8:03 PMEric Riddoch
10/28/2022, 8:05 PM"buildx" to appear in the docker buildx --help output. I mean, it was an error message saying it was an invalid plugin, but still π
. That bypassed bento-cli's check for that string and allowed the build to proceed. But then I got the "elevated privileges" error and gave up.Eric Riddoch
10/28/2022, 8:30 PMShihgian Lee
10/28/2022, 9:43 PMTim Liu
10/28/2022, 10:02 PMTim Liu
10/31/2022, 5:13 PMEric Riddoch
10/31/2022, 5:44 PMEric Riddoch
10/31/2022, 8:03 PMpip install ... and then try to use this new bento version when I run bentoml containerize?Aaron Pham
10/31/2022, 8:05 PMpip install git+<https://github.com/bentoml/bentoml@main>Eric Riddoch
11/10/2022, 7:31 PMAaron Pham
11/10/2022, 8:44 PMAaron Pham
11/19/2022, 12:34 AMEric Riddoch
11/19/2022, 12:56 AMEric Riddoch
11/19/2022, 12:56 AMAaron Pham
11/19/2022, 12:56 AMEric Riddoch
12/07/2022, 4:54 AMpython -m venv venv-containerize-service
. ./venv-containerize-service/bin/activate \
&& python -m pip install bentoml>=1.0.10 \
&& which bentoml \
&& python -m bentoml --version \
&& DOCKER_BUILDKIT=0 \
python -m bentoml containerize keras-ctr-service:latest --docker-image-tag keras-ctr-service:latest --platform linux/amd64
Logs
version 1.0.10
Error: [bentoml-cli] `containerize` failed: BentoML requires BuildKit (via Docker Buildx) to be installed to support multi-arch builds. Buildx comes with Docker Desktop, but one can also install it manually by following instructions via <https://docs.docker.com/buildx/working-with-buildx/#install>.
Can you tell if I'm doing something obviously wrong?Aaron Pham
12/07/2022, 4:57 AMpip install git+<https://github.com/bentoml/bentoml.git@main>
We are in the process of releasing 1.0.11. And it will include the container change.Aaron Pham
12/07/2022, 4:57 AMpython -m might not respect the venvEric Riddoch
12/07/2022, 5:21 AMEric Riddoch
12/07/2022, 5:21 AMAaron Pham
12/07/2022, 9:16 AMpip install bentoml>=1.0.11