0
#!/bin/bash
docker rm -f $(docker ps -qa)
docker rmi -f $(docker images -q)
docker volume rm $(docker volume ls -q)

sudo docker run -d --restart=unless-stopped -p 9090:80 -p 9091:443 --privileged -v /opt/rancher:/var/lib/rancher --name=rancher_docker_server rancher/rancher:latest

I want in this part, before sudo docker a question arises whether to continue?

John Kugelman
  • 307,513
  • 65
  • 473
  • 519
Avi
  • 3
  • 1

1 Answers1

0

Try this:

echo -n "Do you want to continue [Y/n]: "; read choice

if [ $choice == 'Y' ] || [ $choice == 'y' ]; then
sudo docker run -d --restart=unless-stopped -p 9090:80 -p 9091:443 --privileged -v /opt/rancher:/var/lib/rancher --name=rancher_docker_server rancher/rancher:latest
fi
John Kugelman
  • 307,513
  • 65
  • 473
  • 519