Trouble installing pip packages via poetry in running container

I’m trying to use Docker alongside Jenkins for my CI test environment to build some python tools and I’m having trouble installing some pip packages with poetry.

Build script:

#!/bin/bash -x
export PIP_CACHE_DIR=${WORKSPACE}/.cache
python3 -m venv testing-venv
source testing-venv/bin/activate
pip3 install poetry amaranth git+ --upgrade
poetry install

Error: LockFailed - failed to create /.cache/pypoetry/cache/repositories/pypi/_http/0/2/a/8/b/2f84c1a79330-fd479700.855145880276316118529

and I was wondering if anyone had some advice. Full output of the Jenkins build can be found here here: Started by user jenkinsReplayed #12Running as jenkinsConnecting to https:/ -

Jenkins itself is running as a Docker container on an Ubuntu host, then my actual build environment that gets run by Jenkins is defined as follows:

# Use the official image as a parent image
FROM ubuntu:20.04
CMD ["/bin/bash"]

# Override interactive installations and install dependencies
ENV DEBIAN_FRONTEND=noninteractive 
RUN apt-get update && apt-get install -y \
    bison \
    build-essential \
    clang \
    cmake \
    curl \
    dfu-util \
    flex \
    gawk \
    gcc-arm-none-eabi \
    git \
    jq \
    libboost-all-dev \
    libeigen3-dev \
    libreadline-dev \
    openocd \
    pkg-config \
    python3 \
    python3-pip \
    python3-venv \
    python-is-python3 \
    tcl \
    tcl-dev \
    zlib1g-dev \
    && rm -rf /var/lib/apt/lists/*
RUN pip3 install poetry amaranth git+ --upgrade

# build oss-cad-suite from source
RUN curl -L $(curl -s "" \
    | jq --raw-output '.assets[].browser_download_url' | grep "linux-x64") --output oss-cad-suite-linux-x64.tgz \
    && tar zxvf oss-cad-suite-linux-x64.tgz

# add to PATH for pip/source package installations
ENV PATH="/root/.local/bin:/home/jenkins/oss-cad-suite/bin:$PATH"

# Inform Docker that the container is listening on port 8080 at runtime

I also provide some additional build args to the container via Jenkinsfile:

pipeline {
    agent { 
        dockerfile {
            additionalBuildArgs '--build-arg CACHEBUST=$(date +%s)'
            args '--group-add=46 --privileged --device-cgroup-rule="c 189:* rmw" -v /dev/bus/usb:/dev/bus/usb'