fix(run_installation): avoid ((current_step++)) under set -e by using explicit arithmetic increment
This commit is contained in:
@@ -47,15 +47,15 @@ install_docker() {
|
|||||||
esac
|
esac
|
||||||
|
|
||||||
# Add user to the docker group
|
# Add user to the docker group
|
||||||
handle_error sudo usermod -aG docker "$NEW_USER"
|
handle_error $SUDO usermod -aG docker "$NEW_USER"
|
||||||
|
|
||||||
handle_error sudo systemctl enable docker
|
handle_error $SUDO systemctl enable docker
|
||||||
handle_error sudo systemctl start docker
|
handle_error $SUDO systemctl start docker
|
||||||
|
|
||||||
# Configure Docker data directory and optimization
|
# Configure Docker data directory and optimization
|
||||||
if [[ "$DOCKER_DATA_DIR" != "$DEFAULT_DOCKER_DATA_DIR" ]]; then
|
if [[ "$DOCKER_DATA_DIR" != "$DEFAULT_DOCKER_DATA_DIR" ]]; then
|
||||||
log_info "Configuring Docker data directory to $DOCKER_DATA_DIR..."
|
log_info "Configuring Docker data directory to $DOCKER_DATA_DIR..."
|
||||||
handle_error sudo mkdir -p "$DOCKER_DATA_DIR"
|
handle_error $SUDO mkdir -p "$DOCKER_DATA_DIR"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Create optimized Docker daemon configuration
|
# Create optimized Docker daemon configuration
|
||||||
@@ -81,10 +81,10 @@ install_docker() {
|
|||||||
configure_docker_daemon() {
|
configure_docker_daemon() {
|
||||||
log_info "Configuring optimized Docker daemon..."
|
log_info "Configuring optimized Docker daemon..."
|
||||||
|
|
||||||
sudo mkdir -p /etc/docker
|
$SUDO mkdir -p /etc/docker
|
||||||
|
|
||||||
# Create optimized daemon.json
|
# Create optimized daemon.json
|
||||||
cat << EOF | sudo tee /etc/docker/daemon.json
|
cat << EOF | $SUDO tee /etc/docker/daemon.json
|
||||||
{
|
{
|
||||||
"storage-driver": "overlay2",
|
"storage-driver": "overlay2",
|
||||||
"log-driver": "json-file",
|
"log-driver": "json-file",
|
||||||
@@ -109,11 +109,11 @@ EOF
|
|||||||
# Add data-root if custom directory is specified
|
# Add data-root if custom directory is specified
|
||||||
if [[ "$DOCKER_DATA_DIR" != "$DEFAULT_DOCKER_DATA_DIR" ]]; then
|
if [[ "$DOCKER_DATA_DIR" != "$DEFAULT_DOCKER_DATA_DIR" ]]; then
|
||||||
# Modify the daemon.json to include data-root
|
# Modify the daemon.json to include data-root
|
||||||
sudo sed -i "s|{|{\n \"data-root\": \"$DOCKER_DATA_DIR\",|" /etc/docker/daemon.json
|
$SUDO sed -i "s|{|{\n \"data-root\": \"$DOCKER_DATA_DIR\",|" /etc/docker/daemon.json
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Restart Docker to apply configuration
|
# Restart Docker to apply configuration
|
||||||
handle_error sudo systemctl restart docker
|
handle_error $SUDO systemctl restart docker
|
||||||
|
|
||||||
log_success "Docker daemon optimized"
|
log_success "Docker daemon optimized"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user