I have a Dockerfile that runs a bash script:
RUN curl -fsSL URL/remote-setup.sh | bash
$URL/remote-setup.sh
snippet
curl -L $URL/tarball/master | tar -xzv -C $HOME/output_dir --strip-components=1
. "$HOME/output_dir/setup.sh"
$HOME/output_dir/setup.sh
snippet
echo "Make sure we’re using the latest repositories"
apt update
echo " Upgrade any already-installed packages"
apt upgrade
apps=(
awscli
git
golang-go
mysql-server
postgresql postgresql-contrib
screenfetch
tig
tree
zip
zsh
)
echo "Installing..."
apt install "${apps[@]}"
unzip aws-sam-cli-linux-x86_64.zip -d sam-installation
OUTPUT has error
#12 6.126 Installing...
#12 6.128
#12 6.128 WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
#12 6.128
#12 6.155 Reading package lists...
#12 6.699 Building dependency tree...
#12 6.829 Reading state information...
#12 6.965 The following additional packages will be installed:
...
#12 7.267 After this operation, 1498 MB of additional disk space will be used.
#12 7.267 Do you want to continue? [Y/n] Abort.
#12 7.271 % Total % Received % Xferd Average Speed Time Time Time Current
#12 7.272 Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
100 56.6M 100 56.6M 0 0 8848k 0 0:00:06 0:00:06 --:--:-- 13.2M
#12 13.83 ./dir/setup.sh: line 115: unzip: command not found
#12 13.84 sudo: ./sam-installation/install: command not found
The unzip
command & other commands were not found because the list of apps were not installed. It needs to continue with Y
rather than abort
Tried adding ENV DEBIAN_FRONTEND noninteractive
but doesnt work
how do I fix it? thanks
You need to add -y
at the end of your installation command... so that, apt continues installation without prompt... So, your final script should be something like below
echo "Make sure we’re using the latest repositories"
apt update -y
echo " Upgrade any already-installed packages"
apt upgrade -y
apps=(
awscli
git
golang-go
mysql-server
postgresql postgresql-contrib
screenfetch
tig
tree
zip
zsh
)
echo "Installing..."
apt install "${apps[@]}" -y
unzip aws-sam-cli-linux-x86_64.zip -d sam-installation
Hope this helps...