30
29

More than 5 years have passed since last update.

VagrantでUbuntu & Docker環境を構築する

Last updated at Posted at 2013-12-09

公式ドキュメントに書かれていることをそのまま実行しているだけですが、備忘録として。

環境

  • Mac OS X 10.9
    • ホストOS
  • VirtualBox 4.2.18
  • Vagrant 1.3.5
  • Ubuntu 12.04 LTS (Precise) 64bit
    • ゲストOS
  • Docker 0.7.1

手順

Ubuntuのセットアップを行う

Mac
$ mkdir vagrant-ubuntu
$ cd vagrant-ubuntu
$ vagrant init precise64 http://files.vagrantup.com/precise64.box

Vagrantfileを編集する

# 以下の行のコメントを外す
# config.vm.network :private_network, ip: "192.168.33.10"

サーバを立ち上げる

$ vagrant up

SSHの設定

ホストOS上の ~/.ssh/config に以下を追記します。

Host 192.168.33.*
  IdentityFile ~/.vagrant.d/insecure_private_key
  User vagrant

UbuntuにDockerをインストールする

UbuntuにSSHでログインします。

$ ssh 192.168.33.10
$ sudo su -
#

DockerはLinuxカーネル 3.8で動作しますが、Ubuntu 12.04のLinuxカーネルは3.2であるため、アップデートを行います。

# apt-get update
# apt-get install -y linux-image-generic-lts-raring linux-headers-generic-lts-raring
# reboot

次に、

  • DebianのパッケージからDockerをインストールするため、リポジトリのキーをキーチェーンに追加する
  • Dockerのリポジトリをソースリストに追加して、lxc-docker をインストールする

という処理を行ってくれる以下のコマンドを実行して、Dockerをインストールします。

# apt-get install -y curl
# curl -s http://get.docker.io/ubuntu/ | sudo sh

おしまい。

参考

30
29
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
30
29