LoginSignup
40
40

More than 5 years have passed since last update.

Windows7にVirtualBox,Vagrantを入れ、Dockerを試してみる

Posted at

VirtualBoxのインストール

利用しているOS用のインストーラをDLし、実行する
https://www.virtualbox.org/wiki/Downloads

Vagrantのインストール

利用しているOS用のインストーラをDLし、実行する
http://www.vagrantup.com/downloads.html

インストール後、再起動する必要がある。

CoreOSのセットアップ(dockerのホストOS)

$ git clone https://github.com/coreos/coreos-vagrant/
$ cd coreos-vagrant
$ vagrant up

Gitがインストールされていない場合は、適当にインストールする。
※Windowsだとmsysgitとか

PuttyでVagrantのCoreOSに接続する

  1. puttygen.exeを実行し、 既存の秘密鍵の読み込み%HOMEPATH%\.vagrant.d\insecure_private_key を読み込み、 秘密鍵の保存.ppk 形式で保存する
  2. Puttyを開き、ホスト名に core@127.0.0.1 , ポートに 2222 を設定する(ユーザーが vagrantではなく core である点に注意!)
  3. Putty設定 - 接続 - SSH - 認証 で保存した秘密鍵を設定する

これで開けば接続される。

putty_coreos.jpg

CoreOSには最初からDockerがインストールされている。

core@localhost ~ $ docker -v
Docker version 0.7.2, build 28b162e

proxy環境下での実行

以下の投稿を参考に /usr/share/oem/run を編集し、実行権限を付け再起動しても自分の環境ではうまく動かなかった。(調査中)

ダサい!と書かれていたけど、仕方なく以下で実行。

$ sudo systemctl stop docker.service
$ sudo HTTP_PROXY=http://hogeproxy:3128 docker -d

dockerfileの取得

pullコマンドでdockerfileを取得する

$ sudo docker pull ubuntu

コンテナを作成し、Hello world

core@localhost ~ $ docker run ubuntu /bin/echo hello world
hello world
40
40
0

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
40
40