182
Help us understand the problem. What are the problem?

More than 5 years have passed since last update.

posted at

updated at

Organization

docker-machineコマンド

1.マシンの作成・変更・削除

1.1.作成する

$ docker-machine create --driver virtualbox default
Creating VirtualBox VM...
Creating SSH key...
Starting VirtualBox VM...
Starting VM...
To see how to connect Docker to this machine, run: docker-machine env default

--driver, -d "none" Driver to create machine with. Available drivers: amazonec2, azure, digitalocean, exoscale, generic, google, none, openstack, rackspace, softlayer, virtualbox, vmwarefusion, vmwarevcloudair, vmwarevsphere

1.2.削除する

$ docker-machine rm default
machine does not exist, assuming it has been removed already
Successfully removed dev

1.3.TLS証明書を再生成

$ docker-machine regenerate-certs default
Regenerate TLS machine certs?  Warning: this is irreversible. (y/n): y
Regenerating TLS certificates

1.4.Dockerの最新バージョンにマシンをアップグレード

$ docker-machine upgrade default
Stopping machine to do the upgrade...
Upgrading machine default...
Downloading https://github.com/boot2docker/boot2docker/releases/download/v1.8.2/boot2docker.iso to C:\Users\xxxxx\.docker\machine\cache\boot2docker.iso...
Starting machine back up...
Starting VM...

1.5.環境変数の適用(OS X)

$ eval "$(docker-machine env default)"

1.6.環境変数の適用(Windows)

export DOCKER_TLS_VERIFY="1"
export DOCKER_HOST="tcp://192.168.99.102:2376"
export DOCKER_CERT_PATH="/Users/xxxxx/.docker/machine/machines/default"
export DOCKER_MACHINE_NAME="default"

2.利用する

2.1.起動する

$ docker-machine start default
Starting VM...
Started machines may have new IP addresses. You may need to re-run the `docker-machine env` command.

2.2.再起動する

$ docker-machine restart default
Starting VM...
Restarted machines may have new IP addresses. You may need to re-run the `docker-machine env` command.

2.3.停止する

$ docker-machine stop default

2.4.強制停止

$ docker-machine kill default

2.5.接続する

$ docker-machine ssh default
                        ##         .
                  ## ## ##        ==
               ## ## ## ## ##    ===
           /"""""""""""""""""\___/ ===
      ~~~ {~~ ~~~~ ~~~ ~~~~ ~~~ ~ /  ===- ~~~
           \______ o           __/
             \    \         __/
              \____\_______/
 _                 _   ____     _            _
| |__   ___   ___ | |_|___ \ __| | ___   ___| | _____ _ __
| '_ \ / _ \ / _ \| __| __) / _` |/ _ \ / __| |/ / _ \ '__|
| |_) | (_) | (_) | |_ / __/ (_| | (_) | (__|   <  __/ |
|_.__/ \___/ \___/ \__|_____\__,_|\___/ \___|_|\_\___|_|
Boot2Docker version 1.8.2, build master : aba6192 - Thu Sep 10 20:58:17 UTC 2015
Docker version 1.8.2, build 0a8c2e3

2.6.ファイルをコピーする

docker-machine scp dev:/home/docker/test.txt /work/

3.調べる

3.1.使用可能なマシンの確認

$ docker-machine ls
NAME      ACTIVE   DRIVER       STATE     URL                         SWARM
default            virtualbox   Running   tcp://192.168.99.100:2376

3.2.状態の確認

$ docker-machine status default
Running

3.3.IPアドレスの確認

$ docker-machine ip default
192.168.99.100

3.4.環境変数の確認(OS X)

$ docker-machine env default 
export DOCKER_TLS_VERIFY="1"
export DOCKER_HOST="tcp://192.168.99.102:2376"
export DOCKER_CERT_PATH="/Users/xxxxx/.docker/machine/machines/default"
export DOCKER_MACHINE_NAME="default"
# Run this command to configure your shell: 
# eval "$(docker-machine env default)"

3.5.環境変数の確認(Windows)

$ docker-machine env default --shell 'cmd'
export DOCKER_TLS_VERIFY="1"
export DOCKER_HOST="tcp://192.168.99.100:2376"
export DOCKER_CERT_PATH="C:\Users\xxxxx\.docker\machine\machines\default"
export DOCKER_MACHINE_NAME="default"
# Run this command to configure your shell:
# eval "$(docker-machine env default)"

3.6.起動設定の確認する

$ docker-machine config default
--tlsverify --tlscacert="/Users/xxxxx/.docker/machine/machines/default/ca.pem" --tlscert="/Users/xxxxx/.docker/machine/machines/default/cert.pem" --tlskey="/Users/xxxxx/.docker/machine/machines/default/key.pem" -H=tcp://192.168.99.102:2376
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
182
Help us understand the problem. What are the problem?