LoginSignup
11
11

More than 5 years have passed since last update.

Windowsでdockerを動かしてみる

Posted at

Windowsでdockerを動かしてみる

基本的に下記サイトをちゃんと読めば動くみたいです。
Microsoft Windows - Docker Documentation

Windowsにdockerをインストール

  • Docker for Windows Installerからインストーラをダウンロードしてインストールします。あとはひたすらウィザードをぽちぽちします。

dockerの起動

  • デフォルトだと、デスクトップにBoot2Docker Startというショートカットが作成されるので、それをクリックします。

こんな感じのが起動するはずです。

192.168.59.103
connecting...
                        ##        .
                  ## ## ##       ==
               ## ## ## ##      ===
           /""""""""""""""""\___/ ===
      ~~~ {~~ ~~~~ ~~~ ~~~~ ~~ ~ /  ===- ~~~
           \______ o          __/
             \    \        __/
              \____\______/
 _                 _   ____     _            _
| |__   ___   ___ | |_|___ \ __| | ___   ___| | _____ _ __
| '_ \ / _ \ / _ \| __| __) / _` |/ _ \ / __| |/ / _ \ '__|
| |_) | (_) | (_) | |_ / __/ (_| | (_) | (__|   <  __/ |
|_.__/ \___/ \___/ \__|_____\__,_|\___/ \___|_|\_\___|_|
Boot2Docker version 1.5.0, build master : a66bce5 - Tue Feb 10 23:31:27 UTC 2015

Boot2Docker StartDocker version 1.5.0, build a8a31ef
docker@boot2docker:~$
  • 試しにdockerのコマンドを叩いてみます。
docker@boot2docker:~$ docker version

こんな感じでバージョン情報が表示されればOKです。

docker@boot2docker:~$ docker version
Client version: 1.5.0
Client API version: 1.17
Go version (client): go1.4.1
Git commit (client): a8a31ef
OS/Arch (client): linux/amd64
Server version: 1.5.0
Server API version: 1.17
Go version (server): go1.4.1
Git commit (server): a8a31ef

redisを入れてみる

  • 下記コマンドを叩きます。
docker@boot2docker:~$ docker pull redis

こんな感じで表示されればOKです。

docker@boot2docker:~$ docker pull redis
511136ea3c5a: Pull complete
36669626e49c: Pull complete
d5570ef1464a: Pull complete
6b2cc2ba2d5a: Pull complete
1d1bba02d88c: Pull complete
721273364de8: Pull complete
5c38d7c2a1e4: Pull complete
3efd327b4a2f: Pull complete
2e1febeacb96: Pull complete
be58485dad8d: Pull complete
bcfcf50355c9: Pull complete
7059bb73cc90: Pull complete
aee6718e9f51: Pull complete
60a728f7bfed: Pull complete
b9f4429d7461: Pull complete
f94bd3b706e9: Pull complete
ef119c54808b: Pull complete
53b6894a9c8a: Pull complete
redis:latest: The image you are pulling has been verified. Important: image verification is a tech preview feature and should not be relied on to provide security.
Status: Downloaded newer image for redis:latest
docker@boot2docker:~$

redisを動かす

  • 下記コマンドを叩きます。
docker@boot2docker:~$ docker run -p 6379:6379 -d redis

こんな感じで表示されればOKです。

docker@boot2docker:~$ docker run -p 6379:6379 -d redis
299763490f3776420dbabbcabd78bac1644e837d9049536824d4c5cf19c5fb8e
docker@boot2docker:~$

Windowsからredisサーバに接続してみる

  • ホストPC(Windows)からコマンドプロンプトを起動します。

  • telnetコマンドを叩きます。

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Users\john>telnet 192.168.59.103 6379
  • redisのsetコマンドを叩きます。
set mykey "hoge"
+OK
  • redisのgetコマンドを叩きます。
get mykey
$4
hoge

redisサーバが動作していることが確認出来ました。

備考

  • デフォルトのWindows設定だと、telnetコマンドが使用出来ないので下記サイトなどを参考にして許可します。(Windows7の場合)

Telnetクライアント、及びTelnetサーバーの機能の有効化

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