Skip to content

Instantly share code, notes, and snippets.

@goforbroke1006
Last active February 16, 2023 16:03
Show Gist options
  • Save goforbroke1006/43d569252ec6625a4a13644c31e24a38 to your computer and use it in GitHub Desktop.
Save goforbroke1006/43d569252ec6625a4a13644c31e24a38 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Store this file to flash-drive.
# Run as
# bash ./docker-flash.sh
# All images from list below will are installed.
# Also it keep dump nearby of flash-drive to reduce installation time with slow internet connection.
images_arr=(
"debian:bullseye-slim"
"debian:buster-slim"
"debian:jessie-slim"
"ubuntu:22.04"
"golang:1.18"
"golang:1.18-bullseye"
"node:16-alpine"
"python:3.11"
"python:3.8.16-alpine"
"postgres:11.10-alpine"
"clickhouse/clickhouse-server:22.3.10.22-alpine"
"neo4j:4.2.0"
"arangodb:3.10"
"janusgraph/janusgraph:1.0.0-rc1"
"scylladb/scylla:3.1.2"
"confluentinc/cp-kafka:6.0.7"
"wurstmeister/kafka:2.13-2.8.1"
"confluentinc/cp-zookeeper:6.1.9"
"provectuslabs/kafka-ui:latest"
"provectuslabs/kafka-ui:master"
"prom/prometheus:v2.22.2"
"mysql:8.0.32-debian"
"mariadb:10.9.5-jammy"
"phpmyadmin:5.2.1-fpm"
"composer:2.5.4"
"php:8.1-fpm"
"php:8.1.16-fpm-bullseye"
"php:8.0.28-fpm"
"php:7.4-fpm-bullseye"
"nginx:latest"
"nginx:1.23.3-alpine"
)
mkdir -p ./dump
function get_dump_filename() {
local image=$1
local dump_filename=${image}
local dump_filename=${dump_filename//:/.}
local dump_filename=${dump_filename////.}
local dump_filename="./dump/${dump_filename}.tar.gz"
echo "${dump_filename}"
}
for image in ${images_arr[@]}; do
dump_filename=$(get_dump_filename $image)
if [[ "$(docker images -q ${image} 2> /dev/null)" == "" ]]; then
# Image is not found on local machine
if [[ -f ${dump_filename} ]]; then
docker load < "${dump_filename}"
else
docker pull $image
fi
fi
if [[ ! -f ${dump_filename} ]]; then
echo "Save ${image} to ${dump_filename} ..."
docker save $image | gzip > ${dump_filename}
echo "Done."
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment