ラベル vagrant の投稿を表示しています。 すべての投稿を表示
ラベル vagrant の投稿を表示しています。 すべての投稿を表示

2013年12月19日木曜日

Vagrant 1.4.1でCentOS上でdockerを走らせてみる

Vagrantが1.4.1になって、Redhat、CentOSでもdockerのproviderが動くようになったということで、試してみた。

結果

とりあえず動かしてみることは簡単にできた。

Vagrantfileを作る

実行

vagrant up

こんな感じでdockerのコンテナができていることを確認

[otahi@otahiair test-docker-vagrant]$ vagrant up       
Bringing machine 'default' up with 'virtualbox' provider...
[default] Box 'centos65' was not found. Fetching box from specified URL for
the provider 'virtualbox'. Note that if the URL does not have
a box for this provider, you should interrupt Vagrant now and add
the box yourself. Otherwise Vagrant will attempt to download the
full box prior to discovering this error.
Downloading box from URL: https://github.com/2creatives/vagrant-centos/releases/download/v6.5.1/centos65-x86_64-20131205.box
Extracting box...te: 660k/s, Estimated time remaining: --:--:--)
Successfully added box 'centos65' with provider 'virtualbox'!
[default] Importing base box 'centos65'...
[default] Matching MAC address for NAT networking...
[default] Setting the name of the VM...
[default] Clearing any previously set forwarded ports...
[default] Fixed port collision for 22 => 2222. Now on port 2200.
[default] Clearing any previously set network interfaces...
[default] Preparing network interfaces based on configuration...
[default] Forwarding ports...
[default] -- 22 => 2200 (adapter 1)
[default] Booting VM...
[default] Waiting for machine to boot. This may take a few minutes...
[default] Machine booted and ready!
[default] The guest additions on this VM do not match the installed version of
VirtualBox! In most cases this is fine, but in rare cases it can
cause things such as shared folders to not work properly. If you see
shared folder errors, please make sure the guest additions within the
virtual machine match the version of VirtualBox you have installed on
your host and reload your VM.

Guest Additions Version: 4.3.4
VirtualBox Version: 4.2
[default] Mounting shared folders...
[default] -- /vagrant
[default] Running provisioner: docker...
[default] Installing Docker (latest) onto machine...
[default] Pulling Docker images...
[default] -- Image: centos
[otahi@otahiair test-docker-vagrant]$ vagrant ssh
[vagrant@vagrant-centos65 ~]$ sudo docker images        
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
centos              6.4                 539c0211cd76        8 months ago        300.6 MB (virtual 300.6 MB)
centos              latest              539c0211cd76        8 months ago        300.6 MB (virtual 300.6 MB)
[vagrant@vagrant-centos65 ~]$ sudo docker run centos echo hello
hello
[vagrant@vagrant-centos65 ~]$ 

2013年8月4日日曜日

Linux Container (lxc) on Cent OS 6.4 on Vagrant VM

Linux Container(lxc) on Cent OS 6.4 on Vagrant VM

vagrant で作ったCent OS 6.4 のVMの上に、Linux Containerを複数起動できる環境を作る方法をまとめる。 中身はgithubを参照のこと。

背景

  • MacやWindowsをホストとして利用するときに、Linux由来のツールをそのまま利用することが難しい場合がある。
    • たとえば、iptables, openvswitch など
  • lxcの情報はUbuntuの情報が多く、いつも使っているCent OSの情報が少なかったので、ちょっと試した。
  • ちょっとした複数マシン連携のテストなんかに使えるかな?と思う。
  • Tremaの環境を作って遊びたいときに使えるのではないか?とか。

構成

lxcのVM2つをvagrant で作ったCent OS のVMの上に作る。

layout.

事前条件

  • VirtualBox installed(upper 4.2.16)
  • vagrant installed(uppper 1.2.0)
  • vagrant box has been set as "centos64-base"
    • %vagrant box add centos64-base http://developer.nrel.gov/downloads/vagrant-boxes/CentOS-6.4-x86_64-v20130427.box
      • ここのURLはそのうちなくなるかもしれない

動かし方

  • git リポジトリをとってくる
    • %git clone https://github.com/otahi/vagrant-centos-lxc.git
  • vagrant up
    • %vagrant up
  • しばし待つ
  • vagrant VMにログイン
    • %vagrant ssh
  • lxc VMs にログイン
    • %sudo lxc-console -n vm1
    • %sudo lxc-console -n vm2
  • これで構成図のとおりのVMが動いているはず。

2013年6月28日金曜日

Vagrantでパケアナ #pakeana 16

第16回「ネットワークパケットを読む会(仮)」で話した。

PC上のVMで他人に迷惑をかけずに実験をするための方法を考えたので、突っ込みをください。


Vagrant packana16-otahi from Hiroshi Ota


※init.shの最終行は2013/06/29追加。これがないと、HostOnlyNetwork以外はIPパケットがでない。

@twovs さんの「how to GET GET」はあとで役に立つと思うので、メモしておく。