#!/usr/bin/env bash
# curl 이미 설치되어 있는지 체크
if ! command -v curl &> /dev/null
then
sudo apt-get update
sudo apt-get install -y curl
fi
# apt-transport-https 이미 설치되어 있는지 체크
if ! dpkg -s apt-transport-https &> /dev/null
then
sudo apt-get update
sudo apt-get install -y apt-transport-https
fi
# ca-certificates 이미 설치되어 있는지 체크
if ! dpkg -s ca-certificates &> /dev/null
then
sudo apt-get update
sudo apt-get install -y ca-certificates
fi
# gnupg-agent 이미 설치되어 있는지 체크
if ! dpkg -s gnupg-agent &> /dev/null
then
sudo apt-get update
sudo apt-get install -y gnupg-agent
fi
# software-properties-common 이미 설치되어 있는지 체크
if ! dpkg -s software-properties-common &> /dev/null
then
sudo apt-get update
sudo apt-get install -y software-properties-common
fi
# Docker 공식 GPG key 이미 추가되어 있는지 체크
if ! curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key list | grep Docker &> /dev/null
then
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
fi
# Docker repository 등록
if ! apt-cache policy | grep https://download.docker.com/linux/ubuntu | grep stable &> /dev/null
then
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
fi
# 기본적인 패키지들이 최신 버전인지 확인
sudo apt-get update
# docker-ce 이미 설치되어 있는지 체크
if ! dpkg -s docker-ce &> /dev/null
then
# Docker 설치
sudo apt-get install -y docker-ce docker-ce-cli containerd.io
fi
# docker 그룹에 사용자 추가
sudo usermod -aG docker $USER
# Centos7 컨테이너 실행
sudo docker run --privileged -d -p 5432:5432 --name centos centos:7 /sbin/init
There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.
Command: ["startvm", "d7c9b9b1-a0d1-4ff2-b119-3a33f10a1540", "--type", "gui"]
Stderr: VBoxManage: error: The virtual machine 'cent7-1' has terminated unexpectedly during startup because of signal 6
VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component MachineWrap, interface IMachine
시도해본 방법
호스트 재부팅 - 실패
virtualbox와 virtualbox extension pack 버전 맞추기 - 실패
VM headless 모드로 시작 - 시도 전
결론
설치를 진행하고 있는 ubuntu 자체가 인스턴스 환경이어서 그 위에 또 가상환경(VM)을 띄우는게 불가능한 것으로 판단..
vagrant 대신 호스트 OS 위에 하이퍼바이저를 띄우지 않는 구조인 docker로 진행하기로 결정!