• 从windows CMD 命令行(CMD promp)运行Docker


    英文原帖

    Running Docker from Windows CMD prompt

    https://medium.com/@neil.avery_68603/running-docker-from-windows-cmd-prompt-6540daebedad


    #### 打开CMD窗口,尝试运行docker命令,检查docker环境是否可用 `docker run hello-world`
    C:UsersNovakZheng>docker run hello-world
    
    docker: error during connect: Post http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.31/c
    ontainers/create: open //./pipe/docker_engine: The system cannot find the file s
    pecified. In the default daemon configuration on Windows, the docker client must
     be run elevated to connect. This error may also indicate that the docker daemon
     is not running.
    See 'docker run --help'.
    

    尝试其它docker命令, `docker ps`
    C:UsersNovakZheng>docker ps
    
    error during connect: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.31/containers
    /json: open //./pipe/docker_engine: The system cannot find the file specified. I
    n the default daemon configuration on Windows, the docker client must be run ele
    vated to connect. This error may also indicate that the docker daemon is not run
    ning.
    

    用指令建立docker环境 docker-machine env

    C:UsersNovakZheng>docker-machine env default
    
    SET DOCKER_TLS_VERIFY=1
    SET DOCKER_HOST=tcp://192.168.99.100:2376
    SET DOCKER_CERT_PATH=C:UsersNovakZheng.dockermachinemachinesdefault
    SET DOCKER_MACHINE_NAME=default
    SET COMPOSE_CONVERT_WINDOWS_PATHS=true
    REM Run this command to configure your shell:
    REM     @FOR /f "tokens=*" %i IN ('docker-machine env default') DO @%i
    

    再运行上文中REM后面的指令来configure your shell (CMD prompt)

    C:UsersNovakZheng>@FOR /f "tokens=*" %i IN ('docker-machine env default') DO @%i
    

    #### 尝试docker指令,检验是否能够执行 , `docker run hello-world`
    C:UsersNovakZheng>docker run hello-world
    
    Hello from Docker!
    This message shows that your installation appears to be working correctly.
    
    To generate this message, Docker took the following steps:
     1. The Docker client contacted the Docker daemon.
     2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
     3. The Docker daemon created a new container from that image which runs the
        executable that produces the output you are currently reading.
     4. The Docker daemon streamed that output to the Docker client, which sent it
        to your terminal.
    
    To try something more ambitious, you can run an Ubuntu container with:
     $ docker run -it ubuntu bash
    
    Share images, automate workflows, and more with a free Docker ID:
     https://cloud.docker.com/
    
    For more examples and ideas, visit:
     https://docs.docker.com/engine/userguide/
    
    
    C:UsersNovakZheng>docker ps
    CONTAINER ID        IMAGE               COMMAND             CREATED
    STATUS              PORTS               NAMES
    

    以上输出,证明docker环境已经可以在CMD下面运行了。

  • 相关阅读:
    决策树(chap3)Machine Learning In Action学习笔记
    AdaBoost-Machine Learning In Action学习笔记
    支持向量机-Machine Learning In Action学习笔记
    Alamofire 4.0 迁移指南
    从VSS到SVN再到Git 记Git的基本操作
    倍杀测量者
    P3166 数三角形
    APIO2014 序列分割(斜率优化好题)
    P3694 邦邦的大合唱站队
    ACwing 298 栅栏(单调队列DP)
  • 原文地址:https://www.cnblogs.com/lion-zheng/p/7533170.html
Copyright © 2020-2023  润新知