Vagrantfile
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "bento/centos-7.4"
config.vm.hostname = "co74rancher"
config.vm.network :public_network, ip:"192.168.1.115"
config.vm.network "private_network", ip: "192.168.55.115", :netmask => "255.255.255.0"
config.vm.provider :virtualbox do |vbox|
vbox.name = "co74rancher"
vbox.cpus = 4
vbox.memory = 4096
vbox.customize ["modifyvm", :id, "--nicpromisc2","allow-all"]
end
config.vm.provision "shell", inline: <<-SHELL
yum install -y yum-utils device-mapper-persistent-data lvm2
yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
yum-config-manager --disable docker-ce-edge
yum -y install docker-ce
systemctl enable docker
systemctl start docker
mkdir -p /opt/rancher/mysql
docker swarm init --advertise-addr 192.168.55.115 | grep -e '--token' | sed -e 's/ //' - > /vagrant/joincmd.sh
docker run -d -v /opt/rancher/mysql:/var/lib/mysql --restart=unless-stopped -p 8080:8080 rancher/server
SHELL
end
仮想マシンを構築後、以下の初期設定を行います。

1.ブラウザでhttp://192.168.55.115:8080/にアクセスして、Add a hostをクリック

2.Saveをクリック

3.下へスクロール

4.ホストを登録するのに5番に表示されたコマンドを、SSHなどでサーバにログオンして実行。

5.ADMINメニューをクリック

6.ローカル認証を選択

7.ユーザ名、パスワードを入力して、「Enable Local Auth」を選択

8.セキュリティ有効後は、上記のようなログイン画面が表示される
○関連情報
Vagrantでshipyardがインストールされた仮想マシンを構築する
0 件のコメント:
コメントを投稿