blob: e656bb0de189c3a267213bd43a557fa51a2ebf0c (
plain)
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
33
34
35
36
37
38
39
40
41
42
|
#!/bin/sh
# shellcheck disable=SC1091
. ../../lib/sh-test-lib
OUTPUT="$(pwd)/output"
RESULT_FILE="${OUTPUT}/result.txt"
export RESULT_FILE
IMAGE="aarch64/ubuntu"
usage() {
echo "$0 [-i <image>]" 1>&2
exit 1
}
while getopts "i:h" o; do
case "$o" in
i) IMAGE="${OPTARG}" ;;
h|*) usage ;;
esac
done
! check_root && error_msg "You need to be root to run this script."
create_out_dir "${OUTPUT}"
dist_name
# shellcheck disable=SC2154
case "${dist}" in
debian|ubuntu) pkgs="docker-engine" ;;
fedora|centos) pkgs="docker" ;;
*) error_msg "Unsupported distribution" ;;
esac
skip_list="start-docker-service run-docker-image"
install_deps "${pkgs}"
exit_on_fail "install-docker" "${skip_list}"
skip_list="run-docker-image"
systemctl start docker
exit_on_fail "start-docker-service" "${skip_list}"
docker run -it "${IMAGE}" /bin/echo "Hello Docker"
check_return "run-docker-image"
|