From aef1c0c4be080e93e177cbbd4100ab67524e7dbc Mon Sep 17 00:00:00 2001 From: Marcus Robinson Date: Fri, 18 Aug 2023 15:55:44 +0100 Subject: [PATCH] Check docker return code before running commands (#3674) * Add check for return code * Update changelog --------- Co-authored-by: Sven Aelterman <17446043+SvenAelterman@users.noreply.github.com> --- CHANGELOG.md | 1 + devops/scripts/set_docker_sock_permission.sh | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2e92e9b8e..0e1243602 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ ENHANCEMENTS: BUG FIXES: * Apply missing lifecycle blocks. ([#3670](https://github.com/microsoft/AzureTRE/issues/3670)) * Outputs of type boolean are stored as strings ([#3655](https://github.com/microsoft/AzureTRE/pulls/3655)) +* Check docker return code in set docker sock permissions file ([#3674](https://github.com/microsoft/AzureTRE/pulls/3674)) * Increase reliability of Nexus deployment ([[#3642](https://github.com/microsoft/AzureTRE/issues/3642)) diff --git a/devops/scripts/set_docker_sock_permission.sh b/devops/scripts/set_docker_sock_permission.sh index 071a79b5d..7f80d78d1 100644 --- a/devops/scripts/set_docker_sock_permission.sh +++ b/devops/scripts/set_docker_sock_permission.sh @@ -4,5 +4,8 @@ set -e # By default the docker.sock file is not associated with docker group on codespaces or macOS # which causes a permission issue when docker is run without sudo. -sudo chgrp docker /var/run/docker.sock -sudo chmod g+rw /var/run/docker.sock +if ! docker ps > /dev/null 2>&1; then + echo "docker ps failed, setting docker.sock permissions" + sudo chgrp docker /var/run/docker.sock + sudo chmod g+rw /var/run/docker.sock +fi