Code example sharing on how to install Docker on Windows

黄舟
Release: 2017-06-07 09:37:04
Original
1914 people have browsed it

Download Docker for Windows

Stable version

Prepare to install Docker for Windows
Before installation, please ensure that the Windows 10 version is greater than or equal to 1703, and the os version is greater than or equal to 15063
I When installing under version 1607, there will be an error that the referenced assembly file cannot be found
The Hyper-V package must be enabled for Docker for Windows to work. If your system does not meet these requirements, you can install Docker Toolbox, which uses Oracle Virtual Box instead of Hyper-V.
Install Hyper-V on Windows 10 URL

Install Docker for Windows
Double-click InstallDocker.msi to run the installer.

Check Docker
Open PowerShell and enter the following code

PS C:\Users\Docker> docker --version
Docker version 17.03.0-ce, build 60ccb22

PS C:\Users\Docker> docker-compose --version
docker-compose version 1.11.2, build dfed245

PS C:\Users\Docker> docker-machine --version
docker-machine version 0.10.0, build 76ed2a6
Copy after login

Run docker run hello-world to test pulling an image from Docker Hub and starting a container.

PS C:\Users\jdoe> docker run hello-world
Copy after login
Hello from Docker. This message shows that your installation appears
to be working correctly.
To generate this message, Docker took the following steps:
The Docker client contacted the Docker daemon.
The Docker daemon pulled the "hello-world" image from the Docker Hub.
The Docker daemon created a new container from that image which runs the executable that produces the output you are currently
reading.
The Docker daemon streamed that output to the Docker client, which sent it to your terminal.
Copy after login

Try something more ambitious and run an Ubuntu container using this command.
This will download the ubuntu container image and start it. Below is the output of running this command in powershell.

PS C:Usersjdoe> docker run -it ubuntu bash
Unable to find image 'ubuntu:latest' locally latest: Pulling from
library/ubuntu 5a132a7e7af1: Pull complete fd2731e4c50c: Pull complete
28a2f68d1120: Pull complete a3ed95caeb02: Pull complete Digest:
sha256:4e85ebe01d056b43955250bbac22bdb8734271122e3c78d21e55ee235fc6802d
Status: Downloaded newer image for ubuntu:latest
Copy after login

Use docker to open the nginx server

PS C:\Users\jdoe> docker run -d -p 80:80 --name webserver nginx
Copy after login
Unable to find image 'nginx:latest' locally latest: Pulling from
library/nginx
fdd5d7827f33: Pull complete a3ed95caeb02: Pull complete 716f7a5f3082:
Pull complete 7b10f03a0309: Pull complete Digest:
sha256:f6a001272d5d324c4c9f3f183e1b69e9e0ff12debeb7a092730d638c33e0de3e
Status: Downloaded newer image for nginx:latest
dfe13c68b3b86f01951af617df02be4897184cbf7a8b4d5caf1c3c5bd3fc267f
访问http://localhost/以显示nginx起始页。
Copy after login

Use the docker ps command to view the container list
Use the docker images command to view the mirror list

Accelerator

In Select Settings from the right-click menu of the tray icon in the lower right corner of the system. After opening the configuration window, select Docker Daemon from the left navigation menu. Edit the JSON string in the window and fill in the accelerator address such as Alibaba Cloud, DaoCloud, etc., such as:

 {
     "registry-mirrors": [
       "https://sr5arhkn.mirror.aliyuncs.com",
       "http://14d216f4.m.daocloud.io"
     ],
     "insecure-registries": []
   }
Copy after login

The above is the detailed content of Code example sharing on how to install Docker on Windows. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact [email protected]
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!