the script pauses after Docker install and won’t run further until ‘exit’ is entered

  docker, docker-compose, installation, linux-mint

I’ve a made script to automate initial system setup on Linux Mint 20. The script runs fine until after finishing docker install just before docker-compose installation.

After docker is installed the script stays on bash prompt until the usrer enters exit, afterwards the script continues it’s normal execution. It’s a small annoyance, but I’m not sure why it’s occuring.

Thanks, appriciate the help.

# install SSH Server for remote ssh access
echo "########### INSTALL SSH SERVER ###########"

sudo apt update
sudo apt install -y openssh-server
sudo systemctl status ssh

# git
echo "########### SETUP GIT ###########"
sudo apt install -y git

# firewall config (UFW)
echo "########### SETUP UFW ###########"

sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw allow ssh
sudo ufw allow http
sudo ufw allow https

sudo ufw enable
sudo ufw status verbose

# network traffic analyzers (TCPDUMP, Wireshark)
echo "########### INSTALL NETWORK TRAFFIC ANALYSERS ###########"

sudo apt install -y tcpdump
sudo apt install -y wireshark

# Docker
echo "########### INSTALL DOCKER CE ###########"

sudo apt-get update
sudo apt-get -y install apt-transport-https ca-certificates curl software-properties-common

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(. /etc/os-release; echo "$UBUNTU_CODENAME") stable"
sudo apt-get update

sudo apt-get -y  install docker-ce docker-ce-cli containerd.io
sudo usermod -aG docker $USER
newgrp docker

sudo systemctl enable docker
sudo systemctl start docker

# Docker Compose
echo "########### INSTALL DOCKER-COMPOSE ###########"

sudo curl -L "https://github.com/docker/compose/releases/download/1.26.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
# sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose # if docker-compose command isn't found

# Deploy HighSpeed Repo(Grapher)
username=$(id -nu 1000)

mkdir /home/$username/git-projects
cd /home/$username/git-projects

git clone https://uname:[email protected]/appliedphilo/HighSpeed.git
cd HighSpeed
docker-compose up --detach

# Anydesk
echo "########### INSTALL ANYDESK ###########"

wget -qO - https://keys.anydesk.com/repos/DEB-GPG-KEY | sudo apt-key add -
sudo sh -c 'echo "deb http://deb.anydesk.com/ all main" > /etc/apt/sources.list.d/anydesk-stable.list'
sudo apt update
sudo apt install anydesk

# static IPv4 - reserved in router (IPv4:MAC)
echo "########### SETUP STATIC IPv4 ###########"

iname=$(ip -o link show | sed -rn '/^[0-9]+: en/{s/.: ([^:]*):.*//p}') # ethernet interface
ip4=$(/sbin/ip -o -4 addr list $iname | awk '{print $4}' | cut -d/ -f1)
secondary_ip4='192.168.20.5' # subject to change
gateway=$(ip r | awk '/default/ { print $3 }')


echo "network:" | sudo tee -a /etc/netplan/01-netcfg.yaml
echo "  version: 2" | sudo tee -a /etc/netplan/01-netcfg.yaml
echo "  renderer: networkd" | sudo tee -a /etc/netplan/01-netcfg.yaml
echo "  ethernets:" | sudo tee -a /etc/netplan/01-netcfg.yaml
echo "    $iname:" | sudo tee -a /etc/netplan/01-netcfg.yaml
echo "     dhcp4: no" | sudo tee -a /etc/netplan/01-netcfg.yaml
echo "     addresses: [$ip4/24, $secondary_ip4/24]" | sudo tee -a /etc/netplan/01-netcfg.yaml # sets dual IPs for ethernet port
echo "     gateway4: $gateway" | sudo tee -a /etc/netplan/01-netcfg.yaml
echo "     nameservers:" | sudo tee -a /etc/netplan/01-netcfg.yaml
echo "       addresses: [8.8.8.8]" | sudo tee -a /etc/netplan/01-netcfg.yaml

sudo netplan apply

Source: Docker Questions

LEAVE A COMMENT