File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -367,13 +367,19 @@ do_install() {
367367 echo
368368 exit 1
369369 fi
370+ search_command=" apt-cache madison 'docker-ce-cli' | grep '$pkg_pattern ' | head -1 | cut -d' ' -f 4"
371+ # Don't insert an = for cli_pkg_version, we'll just include it later
372+ cli_pkg_version=" $( $sh_c " $search_command " ) "
370373 pkg_version=" =$pkg_version "
371374 fi
372375 fi
373376 (
374377 if ! is_dry_run; then
375378 set -x
376379 fi
380+ if [ -n " $cli_pkg_version " ]; then
381+ $sh_c " apt-get install -y -qq --no-install-recommends docker-ce-cli=$cli_pkg_version >/dev/null"
382+ fi
377383 $sh_c " apt-get install -y -qq --no-install-recommends docker-ce$pkg_version >/dev/null"
378384 )
379385 echo_docker_as_nonroot
@@ -429,6 +435,9 @@ do_install() {
429435 echo
430436 exit 1
431437 fi
438+ search_command=" $pkg_manager list --showduplicates 'docker-ce-cli' | grep '$pkg_pattern ' | tail -1 | awk '{print \$ 2}'"
439+ # It's okay for cli_pkg_version to be blank, since older versions don't support a cli package
440+ cli_pkg_version=" $( $sh_c " $search_command " | cut -d' :' -f 2) "
432441 # Cut out the epoch and prefix with a '-'
433442 pkg_version=" -$( echo " $pkg_version " | cut -d' :' -f 2) "
434443 fi
@@ -437,6 +446,10 @@ do_install() {
437446 if ! is_dry_run; then
438447 set -x
439448 fi
449+ # install the correct cli version first
450+ if [ -n " $cli_pkg_version " ]; then
451+ $sh_c " $pkg_manager install -y -q docker-ce-cli-$cli_pkg_version "
452+ fi
440453 $sh_c " $pkg_manager install -y -q docker-ce$pkg_version "
441454 )
442455 echo_docker_as_nonroot
You can’t perform that action at this time.
0 commit comments