質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.50%
VirtualBox

VirtualBoxは、現在米オラクル社が開発している、 x86仮想化ソフトウェア・パッケージの一つです。

Vagrant

Vagrantは、VirtualBox上の仮想マシンを コマンドラインから作成してくれるソフトウェアです。 ビルド環境など容易に構築が可能です。

Q&A

解決済

1回答

774閲覧

複数の仮想マシンを立ち上げようとしたら、古い方の仮想マシンが立ち上がらないようになった。

mango

総合スコア33

VirtualBox

VirtualBoxは、現在米オラクル社が開発している、 x86仮想化ソフトウェア・パッケージの一つです。

Vagrant

Vagrantは、VirtualBox上の仮想マシンを コマンドラインから作成してくれるソフトウェアです。 ビルド環境など容易に構築が可能です。

0グッド

0クリップ

投稿2018/10/06 12:14

問題点:vagrant up でエラーが出る

解決したいこと:1つ目の仮想マシンを正常に起動させられるようにすることと、複数の仮想マシンを正常に立ち上げる際には、どの点に注意すれば良いのか。

###問題に至った経緯
2つ目の仮想マシンを立ち上げようと思って、新たなフォルダを作り、そこにvagrantfileを作って、2つ目の仮想マシンを起動させた。
しかし、1つ目の仮想マシンに戻ろうと思い、フォルダに移動してvagrant upしたら下記のエラーが出てきて、立ち上げられないようになってしまった。

mba:centos mango$ vagrant up Bringing machine 'default' up with 'virtualbox' provider... ==> default: Checking if box 'centos/7' is up to date... ==> default: A newer version of the box 'centos/7' for provider 'virtualbox' is ==> default: available! You currently have version '1804.02'. The latest is version ==> default: '1809.01'. Run `vagrant box update` to update. Vagrant cannot forward the specified ports on this VM, since they would collide with some other application that is already listening on these ports. The forwarded port to 2222 is already in use on the host machine. To fix this, modify your current project's Vagrantfile to use another port. Example, where '1234' would be replaced by a unique host port: config.vm.network :forwarded_port, guest: 22, host: 1234 Sometimes, Vagrant will attempt to auto-correct this for you. In this case, Vagrant was unable to. This is usually because the guest machine is in a state which doesn't allow modifying port forwarding. You could try 'vagrant reload' (equivalent of running a halt followed by an up) so vagrant can attempt to auto-correct this upon booting. Be warned that any unsaved work might be lost.

###2つ目の仮想マシンを立ち上げる際に行った一連の流れ
ホームディレクトリに移動
cd

今後複数の仮想マシンを作ることを想定して、それらをまとめるフォルダ(MyVagrant)を作る
mkdir MyVagrant

MyVagrantに移動する
cd MyVagrant

仮想マシンを作るフォルダを作る(MyCentOS)
mkdir MyCentOS

MyCentOSに移動する
cd MyCentOS

仮想マシン設定用のVagrantfileを作る
vagrant init bento/centos-6.8

Vagrantfileを編集して仮想マシンのIPアドレスを192.168.33.10にする
sed -i '' -e 's/# config.vm.network "private_network", ip: "192.168.33.10"/config.vm.network "private_network", ip: "192.168.33.10"/' Vagrantfile

仮想マシンを起動する(少し時間かかります)
vagrant up

仮想マシンの状態を確認する
vagrant status

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

自己解決

別の場所でvagrant立ち上がっていたために、うまくいかなかった。
vagrant halt → vagrant up でいけた。

投稿2018/10/06 12:28

mango

総合スコア33

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.50%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問