首页 技术 正文
技术 2022年11月14日
0 收藏 772 点赞 2,217 浏览 2212 个字

英文原帖

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:\Users\NovakZheng>docker run hello-worlddocker: 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:\Users\NovakZheng>docker pserror 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:\Users\NovakZheng>docker-machine env defaultSET DOCKER_TLS_VERIFY=1
SET DOCKER_HOST=tcp://192.168.99.100:2376
SET DOCKER_CERT_PATH=C:\Users\NovakZheng\.docker\machine\machines\default
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:\Users\NovakZheng>@FOR /f "tokens=*" %i IN ('docker-machine env default') DO @%i

#### 尝试docker指令,检验是否能够执行 , `docker run hello-world`

C:\Users\NovakZheng>docker run hello-worldHello 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 bashShare 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:\Users\NovakZheng>docker ps
CONTAINER ID IMAGE COMMAND CREATED
STATUS PORTS NAMES

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

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:8,944
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,469
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,283
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,099
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,729
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,766