Browse Source

new: added ``docker_image_export_dir``, ``service_base_image_export_dir`` helper function

This implements a missing feature in docker to allow to export some
part of a docker image.
checking
Valentin Lab 5 years ago
parent
commit
d700a9f1b8
  1. 24
      bin/compose-core

24
bin/compose-core

@ -495,6 +495,30 @@ image_exposed_ports_0() {
}
export -f image_exposed_ports_0
## feature not yet included in docker: https://github.com/moby/moby/issues/16079
docker_image_export_dir() {
local image="$1" src="$2" dst="$3" container_id
(
container_id=$(docker create "$image") || exit 1
trap_add EXIT,ERR "docker rm \"$container_id\" >/dev/null"
docker cp "$container_id":"$src" "$dst"
)
}
export -f docker_image_export_dir
service_base_image_export_dir() {
local service="$1" src="$2" dst="$3" base_image
shift
base_image=$(service_base_docker_image "$service") || return 1
if ! docker_has_image "$base_image"; then
docker pull "$base_image"
fi
docker_image_export_dir "$base_image" "$src" "$dst"
}
export -f service_base_image_export_dir
##
## Generic
##

Loading…
Cancel
Save