diff --git a/startupscript/butane/prepare-devcontainer-cache.sh b/startupscript/butane/prepare-devcontainer-cache.sh index b2b9027db..9d935e95f 100755 --- a/startupscript/butane/prepare-devcontainer-cache.sh +++ b/startupscript/butane/prepare-devcontainer-cache.sh @@ -59,6 +59,13 @@ if [[ -n "${DOCKER_DIR+x}" ]]; then popd fi +# Report success before docker is stopped. On AWS set_metadata tags the instance +# by running the AWS CLI in a container, so it cannot run once the docker daemon +# is gone. +# shellcheck source=/dev/null +source '/home/core/metadata-utils.sh' +set_metadata 'startup_script/status' "COMPLETED" + # Stop docker and prevent it from starting again systemctl mask docker systemctl stop docker @@ -74,9 +81,5 @@ find /var/lib/docker \ ! -name engine-id \ -exec rm -rf {} + -# shellcheck source=/dev/null -source '/home/core/metadata-utils.sh' -set_metadata 'startup_script/status' "COMPLETED" - # Shut down the instance to signal that the image is ready to be saved. systemctl poweroff