1. What is Docker?
Docker is an Open-source project that is a tool for automating the deployment of an application environment within a software container by providing an abstraction and automation add-on layer on a Linux virtual machine. Docker can also package applications and rely on a virtual container to run on any Linux server.
2. Install Docker on Windows
→ Download docker-docker Toolbox.
→ Run the. exe file and follow the steps to install it. I put it in the D:\DockerToolbox.
→ In one step you will be asked to choose which Docker components to install. I chose the default option:
→ I also agreed to install some Oracle add-on components during the installation process.
→ Finally, docker installation was successful.
After installing Docker Tollbox, you will find the following three icons on your desktop:
When I try to open Docker QuickStart, as I did not have any virtual machines, Docker tried to install a virtual machine by default on my behalf, and during the operation I was prompted that my virtualization was disabled and, in order to enable virtualization, I rebooted my computer into the BIOS. Successfully entered the Docker Quickstart Terminal after virtualization was enabled. Docker, after doing some initialization preparation, reminded me that a default machine was created and running, so I opened my Docker virtual machine and found it:
Tip: The Docker terminal is not running in a standard Windows environment, but is running in a special bash environment. The bash environment also requires Docker installation.
Once again, open the Docker QuickStart terminal and you will find a window similar to the following figure:
Now, let's try running a Hello World container ($docker run Hello-world), and if all your preparation is done, you'll get the following results:
3. Create a new Docker from a command prompt at Windows
Now that you have a Docker machine installed on Windows, you may want to create a new Docker machine. So you can follow these steps:
3.1. To create a new Docker machine from a command prompt in Windows, you need to set up Ssh.exe in your environment variable. Ssh.exe in the Git\bin folder, usually installed in C:\Program files or C:\Program files (x86, so I opened the command prompt and added ssh.exe to the PATH environment variable.
Command: Set path=%path%; C:\Program Files\git\bin
3.2. Now, I will use the same VirtualBox drive to create a new machine named Php-machine.
Command: docker-machine create--driver VirtualBox php-machine
3.3. Next, as you can see in the figure above, we need to link Docker with the php-machine we just created.
Command: Docker-machine env my-machine
3.4. This step is to execute a new command in the previous illustration.
Command: for/f "tokens=*"%i in (' Docker-machine env--shell cmd my-machine ') do%i
3.5. We can now list the Docker machines that have been installed by using the following commands. Note that the php-machine you have just installed has been added and running.
Command: Docker-machine ls