[vagrant]centos container install(provider docker)# Virtualation/Docker2023. 4. 5. 08:15
Table of Contents
728x90
반응형
설치환경
[daraksharavim.tistory.com]$ cat /etc/redhat-release
Rocky Linux release 8.6 (Green Obsidian)
[daraksharavim.tistory.com]$ vagrant -v
Vagrant 2.3.4
[daraksharavim.tistory.com]$ docker -v
Docker version 23.0.3, build 3e7cbfd
[daraksharavim.tistory.com]$
베이그런트설치
더보기
[daraksharavim.tistory.com]$ yum install -y yum-utils
[daraksharavim.tistory.com]$ yum-config-manager --add-repo https://rpm.releases.hashicorp.com/RHEL/hashicorp.repo
[daraksharavim.tistory.com]$ yum -y install vagrant
도커설치
더보기
도커 레포지토리 추가
[daraksharavim.tistory.com]$ yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
도커엔진 설치
[daraksharavim.tistory.com]$ yum install docker-ce docker-ce-cli containerd.io
도커 시작
[daraksharavim.tistory.com]$ systemctl start docker
[daraksharavim.tistory.com]$ systemctl status docker
● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
Active: active (running) since Fri 2023-04-07 10:25:07 KST; 2h 30min ago
Docs: https://docs.docker.com
Main PID: 4252 (dockerd)
Tasks: 11
Memory: 456.0M
CGroup: /system.slice/docker.service
└─4252 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
Vagrantfile 생성
[daraksharavim.tistory.com]$ vagrant init
Vagrantfile 수정
Vagrant.configure("2") do |config|
config.vm.box = "generic/centos8"
config.vm.provider "docker" do |d|
d.image = "centos:latest"
d.privileged = true
d.cmd = ["/bin/bash", "-c", "while true; do sleep 3600; done"]
end
end
실행
[daraksharavim.tistory.com]$ vagrant up
Bringing machine 'default' up with 'docker' provider...
==> default: Creating and configuring docker networks...
==> default: Creating the container...
default: Name: vagrant-home_default_1680839179
default: Image: centos:latest
default: Cmd: /bin/bash -c while true; do sleep 3600; done
default: Volume: /home/vagrant-home:/vagrant
default:
default: Container created: 6f03e1678f440ae8
==> default: Enabling network interfaces...
==> default: Starting container...
[daraksharavim.tistory.com]$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
6f03e1678f44 centos:latest "/bin/bash -c 'while…" 19 seconds ago Up 19 seconds vagrant-home_default_1680839179
[daraksharavim.tistory.com]$ vagrant status
Current machine states:
default running (docker)
The container is created and running. You can stop it using
`vagrant halt`, see logs with `vagrant docker-logs`, and
kill/destroy it with `vagrant destroy`.
virtual server connect
[daraksharavim.tistory.com]$ vagrant docker-exec -it -- /bin/sh
sh-4.4# cat /etc/redhat-release
CentOS Linux release 8.4.2105
https://developer.hashicorp.com/vagrant/docs/providers/docker/commands
728x90
반응형
'# Virtualation > Docker' 카테고리의 다른 글
windows(xp~11) install(ft. docker) (0) | 2024.04.04 |
---|---|
zabbix install(ft. docker) (0) | 2024.03.25 |
Vagrant (0) | 2023.04.05 |
docker container 재시작 정책 수정 (0) | 2022.11.18 |
[도커]docker timezone 설정 (0) | 2021.08.30 |
@다크쉐라빔 :: 다크쉐라빔의 주절주절
안녕하세요. 이곳은 IT위주의 잡다한 정보를 올려두는 개인 블로그입니다.
포스팅이 좋았다면 "좋아요❤️" 또는 "구독👍🏻" 해주세요!