File: Build.docker_pull

package info (click to toggle)
charliecloud 0.43-1
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 3,084 kB
  • sloc: python: 6,021; sh: 4,284; ansic: 3,863; makefile: 598
file content (32 lines) | stat: -rwxr-xr-x 604 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/bash
# ch-test-scope: quick
# ch-test-builder-include: docker
# ch-test-need-sudo
#
# Pull a docker image directly from Dockerhub and pack it into an image tarball.

set -e

#srcdir=$1  # unused
tarball_gz=${2}.tar.gz
workdir=$3

tag=docker_pull
addr=alpine:3.17
img=$tag:latest

cd "$workdir"
sudo docker pull "$addr"
sudo docker tag "$addr" "$tag"

# FIXME: do we need a ch_version_docker equivalent?
sudo docker tag "$tag" "$img"


hash_=$(sudo docker images -q "$img" | sort -u)
if [[ -z $hash_ ]]; then
    echo "no such image '$img'"
    exit 1
fi

ch-convert -i docker "$tag" "$tarball_gz"