win10下的docker-machine 安装和移除centos

1、安装docker:https://www.docker.com/products/docker-desktop

2、查看docker 是否安装成功

C:\Users\acer>docker version
Client: Docker Engine - Community
 Version:           19.03.5
 API version:       1.40
 Go version:        go1.12.12
 Git commit:        633a0ea
 Built:             Wed Nov 13 07:22:37 2019
 OS/Arch:           windows/amd64
 Experimental:      false
error during connect: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.40/version: open //./pipe/docker_engine: The system cannot find the file specified. 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.

出现error during等信息,是因为本地安装了VirtualBox,没有启动Hyper-V and Containers features 

如果需要启用,在窗口直接以下命令即可

cd "C:\Program Files\Docker\Docker"

DockerCli.exe -SwitchDaemon

3、查看docker-machine版本

C:\Users\acer>docker-machine version
docker-machine version 0.16.2, build bd45ab13

4、创建centos :docker-machine create demo1

C:\Users\acer>docker-machine create demo1
Creating CA: C:\Users\acer\.docker\machine\certs\ca.pem
Creating client certificate: C:\Users\acer\.docker\machine\certs\cert.pem
Running pre-create checks...
(demo1) Image cache directory does not exist, creating it at C:\Users\acer\.docker\machine\cache...
(demo1) No default Boot2Docker ISO found locally, downloading the latest release...
(demo1) Latest release for github.com/boot2docker/boot2docker is v19.03.5
(demo1) Downloading C:\Users\acer\.docker\machine\cache\boot2docker.iso from https://github.com/boot2docker/boot2docker/releases/download/v19.03.5/boot2docker.iso...
(demo1) 0%....10%....20%....30%....40%....50%....60%....70%....80%....90%....100%
Creating machine...
(demo1) Copying C:\Users\acer\.docker\machine\cache\boot2docker.iso to C:\Users\acer\.docker\machine\machines\demo1\boot2docker.iso...
(demo1) Creating VirtualBox VM...
(demo1) Creating SSH key...
(demo1) Starting the VM...
(demo1) Check network to re-create if needed...
(demo1) Windows might ask for the permission to create a network adapter. Sometimes, such confirmation window is minimized in the taskbar.
(demo1) Found a new host-only adapter: "VirtualBox Host-Only Ethernet Adapter #2"
(demo1) Windows might ask for the permission to configure a network adapter. Sometimes, such confirmation window is minimized in the taskbar.
(demo1) Windows might ask for the permission to configure a dhcp server. Sometimes, such confirmation window is minimized in the taskbar.
(demo1) 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 demo1

5、VirtualBox中查看

6、SSH连接

C:\Users\acer>docker-machine ssh demo1
   ( '>')   ( '>')
  /) TC (\   Core is distributed with ABSOLUTELY NO WARRANTY.
 (/-_--_-\)           www.tinycorelinux.net

7、移除

C:\Users\acer>docker-machine rm demo1
About to remove demo1
WARNING: This action will delete both local reference and remote instance.
Are you sure? (y/n): y
Successfully removed demo1

8、VirtualBox中查看

发布了15 篇原创文章 · 获赞 1 · 访问量 2702

猜你喜欢

转载自blog.csdn.net/u014704612/article/details/103871647