zoukankan      html  css  js  c++  java
  • docker-machine

    docker-machine

    • 查看可用镜像
      docker-machine ls
    • 建立一个节点[root@localhost tmp]# docker-machine create --driver virtualbox default
    [root@localhost tmp]# docker-machine create --driver virtualbox default
    Running pre-create checks...
    Creating machine...
    (default) Copying /root/.docker/machine/cache/boot2docker.iso to /root/.docker/machine/machines/default/boot2docker.iso...
    (default) Creating VirtualBox VM...
    (default) Creating SSH key...
    (default) Starting the VM...
    (default) Check network to re-create if needed...
    (default) Found a new host-only adapter: "vboxnet0"
    (default) Waiting for an IP...
    Waiting for machine to be running, this may take a few minutes...
    Detecting operating system of created instance...
    Waiting for SSH to be available...
    Detecting the provisioner...
    Provisioning with boot2docker...
    Copying certs to the local machine directory...
    Copying certs to the remote machine...
    Setting Docker configuration on the remote daemon...
    Checking connection to Docker...
    Docker is up and running!
    To see how to connect your Docker Client to the Docker Engine running on this virtual machine, run: docker-machine env default
    
    

    (如果系统没有预先安装好boot2docker,需要FQ下载该镜像。)

        [root@localhost tmp]# proxychains4 wget https://github.com/boot2docker/boot2docker/releases/download/v17.06.2-ce/boot2docker.iso
        [root@localhost tmp]# cp boot2docker.iso  /root/.docker/machine/cache/
    
    
    • 显示可用的节点 docker-machine ls
    [root@localhost tmp]# docker-machine ls
    NAME      ACTIVE   DRIVER       STATE     URL                         SWARM   DOCKER        ERRORS
    default   -        virtualbox   Running   tcp://192.168.99.100:2376           v17.06.2-ce   
    
    • 告知 Docker 去 联系新的机器
    [centos@localhost tmp]$ docker-machine env
    Error checking TLS connection: machine does not exist
    [centos@localhost tmp]$ sudo -s
    [sudo] password for centos: 
    [root@localhost tmp]# docker-machine env
    export DOCKER_TLS_VERIFY="1"
    export DOCKER_HOST="tcp://192.168.99.100:2376"
    export DOCKER_CERT_PATH="/root/.docker/machine/machines/default"
    export DOCKER_MACHINE_NAME="default"
    # Run this command to configure your shell: 
    # eval $(docker-machine env)
    [root@localhost tmp]# eval $(docker-machine env)
    
    
    • 获取节点的ip地址 docker-machine ip default
    [root@localhost tmp]# docker run -d -p 8000:80 nginx
    [root@localhost tmp]# curl $(docker-machine ip default):8000
    <!DOCTYPE html>
    <html>
    <head>
    <title>Welcome to nginx!</title>
    <style>
        body {
             35em;
            margin: 0 auto;
            font-family: Tahoma, Verdana, Arial, sans-serif;
        }
    </style>
    </head>
    <body>
    <h1>Welcome to nginx!</h1>
    <p>If you see this page, the nginx web server is successfully installed and
    working. Further configuration is required.</p>
    
    <p>For online documentation and support please refer to
    <a href="http://nginx.org/">nginx.org</a>.<br/>
    Commercial support is available at
    <a href="http://nginx.com/">nginx.com</a>.</p>
    
    <p><em>Thank you for using nginx.</em></p>
    </body>
    </html>
    
    
    • 停止一个节点
    [root@localhost tmp]# docker-machine stop
    Stopping "default"...
    Machine "default" was stopped.
    
    
  • 相关阅读:
    iframe子页面获取父页面元素和window对象
    jQuery使用blur()方法触发两次的解决方法
    java使用freemarker生成word
    java实现下载文件
    IE11中实现颜色渐变
    MYSQL中INET_ATON()函数
    数据库SQL实战(1)
    MYSQL表中向SET类型的字段插入值时值之间不能有空格
    MYSQL表中设置字段类型为TIMESTAMP时的注意事项
    SQL中判断值是否为NULL
  • 原文地址:https://www.cnblogs.com/Ethan2lee/p/7508442.html
Copyright © 2011-2022 走看看