• [^] # Re: Docker, faux problèmes

    Posté par . En réponse au journal Découvrir Docker, Python, LLVM et Emscripten. Évalué à 1. Dernière modification le 24 février 2021 à 15:14.

    J'ai un example fonctionnel sous le coude, pour faire une image docker :

    buildah pull docker.io/alpine:3.12
    buildah pull docker.io/adoptopenjdk/openjdk8-openj9:alpine-jre
    timestamp=$(date +%Y%m%dT%H%M%S)
    image_name=minecraft-papercraft
    build_and_push() {
     local papercraft_build=1ドル
     local branch=2ドル
     local version=${branch}-${timestamp}
     local image_full_name=${image_name}:${version}
     local image_name_no_timestamp=${image_name}:${branch}
     # use docker format as a workaround for corruption
     # https://github.com/containers/buildah/issues/1589 and https://github.com/containers/image/pull/1089
     buildah bud -t "${image_full_name}" \
     --format=docker \
     --build-arg BUILD=${papercraft_build} \
     --build-arg BRANCH=${branch} .
     buildah tag "${image_full_name}" ${image_name_no_timestamp}
     buildah push "${image_full_name}" ${BUILDAH_PUSH_REPOSITORY}/${image_full_name}
     buildah push "${image_name_no_timestamp}" ${BUILDAH_PUSH_REPOSITORY}/${image_name_no_timestamp}
    }

    Il y a aussi buildah run, quand c'est pour faire un build avec une inage docker, mais je n'ai pas d'exemple. Je sais juste qu'on peut l'utiliser à peu près comme docker run

    docker run --rm -ti -v $PWD:/root ubuntu /bin/bash -xe <<EOF
     git clone http://...
     ...
    EOF