[SCRIPT] 명령 한 번으로 Docker, docker-compose 설치!
1. Ubuntu에서 Docker 및 Docker-compose Install/Uninstall
- docker_install.sh
#!/bin/bash echo "===========================================" echo "DOCKER INSTALL START!" echo "===========================================" sudo apt-get update -y &&\ 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 bionic stable" sudo apt update apt-cache policy docker-ce sudo apt install -y docker-ce sudo usermod -aG docker $USER # install docker-compose sudo apt-get install docker-compose-plugin echo "DOCKER VERSION : $(docker --version)" echo "DOCKER COMPOSE VERSION : $(docker compose version)"
- docker_uninstall.sh
#!/bin/bash echo "===========================================" echo "DOCKER UNINSTALL START!" echo "===========================================" sudo apt-get purge -y docker-engine docker docker.io docker-ce sudo apt-get autoremove -y --purge docker-engine docker docker.io docker-ce sudo rm -rf /var/lib/docker /etc/docker sudo rm /etc/apparmor.d/docker sudo groupdel docker sudo rm -rf /var/run/docker.sock sudo rm -rf /usr/local/bin/docker-compose sudo rm -rf /etc/docker sudo rm -rf ~/.docker echo "===========================================" echo "DOCKER UNINSTALLED!" echo "==========================================="
2. CentOS에서 Docker Install
- docker_install.sh
#!/bin/bash sudo yum -y update sudo yum docker install -y sudo systemctl start docker sudo systemctl enable docker sudo systemctl status docker
3. Shell Script 실행
bash docker_install.sh
Leave a comment