I have an image with private visibility on Docker Hub. I would like to use this image during a build step on Docker Hub Build process like so:
FROM kaczmarj/apptainer as builder
ARG APPTAINER_DOCKER_PASSWORD
ARG APPTAINER_DOCKER_USERNAME
WORKDIR /tmp
RUN export APPTAINER_DOCKER_USERNAME=$APPTAINER_DOCKER_USERNAME && \
export APPTAINER_DOCKER_PASSWORD=$APPTAINER_DOCKER_PASSWORD && \
apptainer build image_name.sif docker://user_name/image_name:latest
FROM scratch
COPY --from=builder /tmp/image_name.sif /output/
Additionally I have a build hook like so, to pass the credentials through from the defined build variables.
#!/bin/bash
docker build --build-arg APPTAINER_DOCKER_PASSWORD=$APPTAINER_DOCKER_PASSWORD --build-arg APPTAINER_DOCKER_USERNAME=APPTAINER_DOCKER_USERNAME -f $DOCKERFILE_PATH -t $IMAGE_NAME .
Somehow the credentials are not parsed correctly during build, so the build step fails.
The build works locally.
Alternatively, are there other ways to access the current credentials? Or other ways of wrapping the Apptainer format around docker, except for writing tailored Apptainer definitions?