Docker = Docker Engine
Docker CE: Community Edition
Docker EE: Enterprise Edition
0.X -> 1.X(1.13.X) -> 17.04 -> 20.10
`~/vagrant/container/Vagrantfile
Vagrant.configure("2") do |config|
# Define VM
config.vm.define "docker" do |centos|
centos.vm.box = "ubuntu/focal64"
centos.vm.hostname = "docker"
centos.vm.network "private_network", ip: "192.168.100.100"
centos.vm.provider "virtualbox" do |vb|
vb.name = "docker"
vb.cpus = 2
vb.memory = 4096
end
end
end
~/.ssh/config
Host docker
HostName 192.168.100.100
User vagrant
IdentityFile C:\Users\Playdata\vagrant\container\.vagrant\machines\docker\virtualbox\private_key
sudo apt update
sudo apt install ca-certificates curl gnupg lsb-release
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
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
sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io docker-compose-plugin
sudo usermod -aG docker vagrant
sudo apt install zsh
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
~/.zshrc
...
ZSH_THEME="agnoster"
...
source ~/.zshrc
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-completions ${ZSH_CUSTOM:-${ZSH:-~/.oh-my-zsh}/custom}/plugins/zsh-completions
~/.zshrc
73 plugins=(
74 git
75 zsh-autosuggestions
76 zsh-completions
77 )
source ~/.zshrc
vi ~/.oh-my-zsh/themes/agnoster.zsh-theme
prompt_newline() {
if [[ -n $CURRENT_BG ]]; then
echo -n "%{%k%F{$CURRENT_BG}%}$SEGMENT_SEPARATOR
%{%k%F{blue}%}$SEGMENT_SEPARATOR"
else
echo -n "%{%k%}"
fi
echo -n "%{%f%}"
CURRENT_BG=''
}
추가 후
하단 쪽 ##prompt main -> build prompt 에 추가 작성
'
'
prompt_newline
'
'
vi ~/.oh-my-zsh/themes/agnoster.zsh-theme
prompt_dir() {
prompt_segment 39d $CURRENT_FG '%~' # 39d로 변경 (하늘색)
}
(registry/)repository/name:tag
docker.io/library/hello-world:latest
create -> start -> (pause) -> (unpause) -> (kill) -> stop -> rm
run ---------->
application이 종료 컨테이너도 종료(stop)
-it 옵션은 Shell을 실행하는 이미지에서 사용: centos, ubuntu ...
-d 옵션 application이 계속적으로 실행되어햐 할 때: httpd ...
리눅스 배포판 이름으로된 이미지
자동화된 이미지 빌더(클라우드 이미지 및 컨테이너 이미지 빌더)
https://learn.hashicorp.com/tutorials/packer/get-started-install-cli?in=packer/aws-get-started
sudo yum install -y yum-utils
sudo yum-config-manager --add-repo https://rpm.releases.hashicorp.com/RHEL/hashicorp.repo
sudo yum -y install packer
이미지를 빌드하기 위한 선언과 명령으로 구성된 파일
.pkr.hcl
.pkr.json
mkdir -p packer/aws-ubuntu
cd packer/aws-ubuntu
aws-ubuntu.pkr.hcl
packer {
required_plugins {
amazon = {
version = ">= 0.0.1"
source = "github.com/hashicorp/amazon"
}
}
}
source "amazon-ebs" "ubuntu" {
ami_name = "learn-packer-linux-aws"
instance_type = "t2.micro"
region = "us-west-2"
source_ami_filter {
filters = {
name = "ubuntu/images/*ubuntu-xenial-16.04-amd64-server-*"
root-device-type = "ebs"
virtualization-type = "hvm"
}
most_recent = true
owners = ["099720109477"]
}
ssh_username = "ubuntu"
}
build {
name = "learn-packer"
sources = [
"source.amazon-ebs.ubuntu"
]
provisioner "shell" {
environment_vars = [
"FOO=hello world",
]
inline = [
"echo Installing Redis",
"sleep 30",
"sudo apt-get update",
"sudo apt-get install -y redis-server",
"echo \"FOO is $FOO\" > example.txt",
]
}
}
packer init .
packer fmt .
packer validate .
packer build .