Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: multi-arch parallel builds fails to obtain apt lock #5229

Open
aas47 opened this issue Feb 19, 2025 · 0 comments
Open

bug: multi-arch parallel builds fails to obtain apt lock #5229

aas47 opened this issue Feb 19, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@aas47
Copy link

aas47 commented Feb 19, 2025

Describe the bug

When using buildx, --platform=linux/amd64,linux/arm64 and {% block SETUP_BENTO_BASE_IMAGE %}, bentoml containerize fails with apt unable to obtain lock.

# short snippet
0.583 E: Could not get lock /var/lib/apt/lists/lock. It is held by process 0
0.584 E: Unable to lock directory /var/lib/apt/lists/

I'm new to bentoml so unsure where this config is coming from and how to update it. I haven't found a way to add something like sharing=shared or sharing=locked to this particular instruction. I found this is maybe where it needs to be added? I'm wondering how.

# full error
 > [linux/arm64 base-container  3/12] RUN --mount=type=cache,target=/var/lib/apt --mount=type=cache,target=/var/cache/apt set -eux &&     apt-get update -y &&     apt-get install -q -y --no-install-recommends --allow-remove-essential         ca-certificates gnupg2 bash build-essential:
0.142 + apt-get update -y
0.381 Reading package lists...
0.583 E: Could not get lock /var/lib/apt/lists/lock. It is held by process 0
0.584 E: Unable to lock directory /var/lib/apt/lists/
------
Dockerfile:22
--------------------
  21 |     RUN rm -f /etc/apt/apt.conf.d/docker-clean; echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache
  22 | >>> RUN --mount=type=cache,target=/var/lib/apt --mount=type=cache,target=/var/cache/apt set -eux && \
  23 | >>>     apt-get update -y && \
  24 | >>>     apt-get install -q -y --no-install-recommends --allow-remove-essential \
  25 | >>>         ca-certificates gnupg2 bash build-essential
  26 |     # Build arguments -- passed in by bento as it does not allow env vars to be passed in
--------------------
ERROR: failed to solve: process "/bin/sh -c set -eux &&     apt-get update -y &&     apt-get install -q -y --no-install-recommends --allow-remove-essential         ca-certificates gnupg2 bash build-essential" did not complete successfully: exit code: 100

To reproduce

setup command:

docker buildx create --name container-builder --driver docker-container --bootstrap --use
docker buildx inspect --bootstrap
bentoml containerize testing:latest 
      --backend buildx
      --opt builder=container-builder
      --opt platform=linux/amd64,linux/arm64
      --opt pull
      --opt push
      -t "${MYIMAGETAG}"

and

# Dockerfile.template
{% extends bento_base_template %}
{% block SETUP_BENTO_BASE_IMAGE %}
{{ super() }}
{% endblock %}
{% block SETUP_BENTO_COMPONENTS %}
{{ super() }}
.
.
.
.
.
{% endblock %}

Expected behavior

expect the build to just pass.

Environment

docker:
  dockerfile_template: "Dockerfile.template"
  env:
    BUILD_ENV: local
@aas47 aas47 added the bug Something isn't working label Feb 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant