Windows Docker installation
Docker is not a general purpose container tool, it relies on an existing and running Linux kernel environment.
Docker essentially creates an isolated file environment under the already running Linux, so it performs almost as efficiently as the deployed Linux host.
Therefore, Docker must be deployed on a system with a Linux kernel. If other systems want to deploy Docker, they must install a virtual Linux environment.
The way to deploy Docker on Windows is to first install a virtual machine and run Docker in the virtual machine where the Linux system is installed.
Win10 system
Docker Desktop is the official installation method of Docker on Windows 10 and macOS operating systems. This method still belongs to the method of first installing Linux in a virtual machine and then installing Docker.
Docker Desktop official download address: https://docs.docker.com/desktop/install/windows-install/
Note: This method only works on Windows 10 OS Pro, Enterprise, Education and some Home editions!
Install Hyper-V
Hyper-V is a virtual machine developed by Microsoft, similar to VMWare or VirtualBox, only for Windows 10. This is the virtual machine used by Docker Desktop for Windows.
However, once this virtual machine is enabled, QEMU, VirtualBox or VMWare Workstation 15 and below will not work! If you must use another virtual machine on your computer (e.g. an emulator to develop Android apps), don’t use Hyper-V!
Enable Hyper-V
Programs and Features
Turn Windows features on or off
Select Hyper-V
You can also enable Hyper-V by command, please right-click the start menu and run PowerShell as an administrator, execute the following command:
Enable-WindowsOptionalFeature-Online-FeatureNameMicrosoft-Hyper-V-All
Install Docker Desktop for Windows
Click Get started with Docker Desktop, and download the Windows version, if you are not logged in, you will be asked to register and log in:
Run the installation file
Double-click the downloaded Docker for Windows Installer installation file, click Next all the way, and click Finish to complete the installation.
After the installation is complete, Docker will start automatically. A small whale icon will appear on the notification bar, which means that Docker is running.
Three icons will also appear on the side of the table, as shown in the following figure:
We can execute docker version on the command line to view the version number, and docker run hello-world to load the test image for testing.
If it doesn’t start, you can search for Docker in Windows to start it:
After startup, you can also see the little whale icon on the notification bar:
If you encounter errors caused by WSL 2 during startup, please install WSL 2.
After installation, you can open PowerShell and run the following command to check whether the operation is successful:
docker run hello-world
The following message should appear after a successful run:
win7, win8 system
win7, win8, etc. need to use docker toolbox to install, and domestic users can use the image of Alibaba Cloud to download, download address: http://mirrors.aliyun.com/docker-toolbox/windows/docker-toolbox/
The installation is relatively simple, double-click to run, click Next, you can check the components you need:
docker toolbox is a tool set, which mainly includes the following contents:
- Docker CLI – Client to run docker engine to create images and containers.
- Docker Machine – Lets you run docker engine commands on the Windows command line.
- Docker Compose – Used to run the docker-compose command.
- Kitematic – This is a GUI version of Docker.
- Docker QuickStart shell – This is a command line environment with Docker already configured.
- Oracle VM Virtualbox – virtual machine.
After the download is complete, click Install directly. After the installation is successful, three icons will appear on the side of the table, as shown in the figure below:
Click on the Docker QuickStart icon to launch the Docker Toolbox terminal.
If the system displays the User Account Control window to run VirtualBox to modify your computer, select Yes.
$ symbol where you can enter the following command to execute.
$ docker run hello-world Unable to find image 'hello-world:latest' locally Pulling repository hello-world 91c95931e552:Download complete a8219747be10:Download complete Status:Downloaded newer image for hello-world:latest 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 DockerEngine CLI client contacted the DockerEngine daemon. 2. The DockerEngine daemon pulled the "hello-world" image from the DockerHub. (Assuming it was not already locally available.) 3. The DockerEngine daemon created a new container from that image which runs the executable that produces the output you are currently reading. 4. The DockerEngine daemon streamed that output to the DockerEngine CLI client, which sent it to your terminal. To try something more ambitious, you can run an Ubuntu container with: $ docker run -it ubuntu bash For more examples and ideas, visit: https://docs.docker.com/userguide/