• 从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下面运行了。

  • 相关阅读:
    HttpClient后台post 请求webapi
    [SQL Server] 复制数据库任务
    C# js 在页面能执行,放在单独js文件不能执行
    Flink 中的kafka何时commit?
    jar依赖
    AI重要算法
    NonWindowJoin
    Rocket MQ 源码解析
    linear algebra
    Theories of Deep Learning
  • 原文地址:https://www.cnblogs.com/lion-zheng/p/7533170.html
Copyright © 2020-2023  润新知