Docker learning series (1): install docker under windows

The directory of this article is as follows:


The method of installing docker under windows should refer to the official website of Docker . Before, I referred to the blog translated by other people on the Internet. There were some problems. Later, it was found that because of the fast update speed of docker, the method of installing the official website is the most appropriate!

Here are a few tips from the Docker Chinese guide :

Tip 1: Docker has been tested on Windows 7.1 and Windows 8, of course it can also be used on lower versions of Windows. But your processor must support hardware virtualization.

Tip 2: The Docker engine uses Linux kernel features, so we need to use a lightweight virtual machine (VM) on Windows to run Docker. We use the Docker client for Windows to control the build, run and manage the Docker virtualization engine.

Tip 3: To simplify this process, we have designed an application called Boot2Docker that you can use to install virtual machines and run Docker.

Tip 4: Although you are using the Windows Docker client, the docker engine container is still running on the Linux host (now via the Virtual box). Until we developed a Windows version of Docker Engine, you just need to start a Linux container on your Windows host.


Refer to Install Docker for Windows , that is, follow the steps of this website step by step, the tutorial on this website is very detailed

1. Windows follows the basic requirements of docker

(1) 64 is the operating system, win7 or higher
(2) "Hardware Virtualization Technology" is supported, and "virtualization" is available

2. Specific installation steps

That is to install Docker Toolbox, and also additionally install

  • Docker Client for Windows
  • Docker Toolbox management tool and ISO
  • Oracle VM VirtualBox
  • Don't worry about Git MSYS-git UNIX tools
    , the downloaded Docker Toolbox already includes these softwares, just install it directly

1. Go to the download page of Docker Toolbox , select the windows version to download
write picture description here
2. After the download is complete, double-click the installation file
3. Go to Next, accept all the default installations
write picture description here
write picture description here
write picture description here
write picture description here
write picture description here
write picture description here

Note: During the installation process, there will be several other installation processes, such as Ocacle Corporation and other series of software, you can choose to install all, here are a few small examples:
write picture description here
write picture description here
In addition, if you install 360, it may block the program Installation, you should pay attention to allow the program to install
write picture description here
4. Finally, Finish
write picture description here
5. The entire installation process is very simple. After the installation is complete, you can get the following three icons on the desktop:
write picture description here

3. Get started

1. Click the Docker Quickstart Terminal icon to open a Docker Toolbox terminal
write picture description here
- After opening the terminal, the terminal will automatically perform some settings, which will take some time. After all is completed, the following results will appear.
write picture description here
3. Enter various docker commands after $. docker can be used
Note : no need to use sudo like in ubuntu!
For example:
(1) View the version information of docker

docker info
  • 1
  • 1

write picture description here
(2) Log in to the account of docker Hub

docker login
  • 1
  • 1

Then, enter the user name and password. For example, I
write picture description here
personally think that when using docker, whether or not to log in has no particular impact, but if you log in, you can push your own image to the docker hub.

4. Install the remote connection tool to connect to docker

After opening the Docker Toolbox terminal according to the above method, it is found that the operations such as copying and pasting cannot be performed in the terminal, which is very inconvenient to use. Therefore, refer to the blog post of zistxym here to install the remote connection tool SecureCRT

  • Download SecureCRT
    address: NSFOCUS SecureCRT green version is free to install , I don’t know why, sometimes these two links suggest that there is a virus, so, provide another link to Baidu cloud disk , extraction code: rm3g
  • run SecureCRT
    write picture description here
  • Connect to docker
    write picture description here
    write picture description here
    Note: The default username and password are: docker/tcuser

  • Using SecureCRT is the same as using Docker Quickstart Terminal
    write picture description here
    write picture description here

    • When using SecureCRT to connect to docker, you must first start Docker Quickstart Terminal
  • A few settings about SecureCRT
    (1) During use, it is found that the right mouse button function of secureCRT is a paste function by default, which is inconsistent with the style of the windows system. To copy and edit operations, you can change paste on to: right button in the options menu—"global options—"terminal—-"mouse function block.
    write picture description here
    At this time, when you right-click the mouse, a menu of text operation functions will pop up. , as follows:
    write picture description here
    (2) Change the font and background of secureCRT
    write picture description here
    write picture description here
    Just change the font of the current section
    write picture description here

5. Problems encountered during installation

After all installations are completed, open the Docker Quickstart Terminal, and the following error may occur:
write picture description here
This is because the computer does not enable the VT-X/AMD-v function, that is, the virtualization technology is not enabled, you need to restart the computer and go to the BIOS to enable this function

When using image to generate an image, the following error occurred

flag provided but not defined:

I thought it was because the versions of the docekr service and the client were different, and various queries were tossed and unsuccessful. Finally, I found that there was actually a missing space between -v and the path in the command! It's my fault that I didn't check the error reminder carefully.
write picture description here
~~~~~~~~~~
write picture description here

6. Docker updates

If the docker installed on the machine is out of date, that is, when a new version of docker is released, the docker on the machine should be updated, otherwise it is likely to affect its continued use. Then, the update of the docker on the machine can be installed in the following ways :
(1) Open the Docker Quickstart Terminal
(2) Enter the command: docker-machine upgrade default
it will start to automatically update the local docker, as shown in the following figure
write picture description here
(3) Check the docker version

docker version
  • 1
  • 1

write picture description here

write picture description here

7. Jupyter in Docker

The image I used has jupyter, but I found that according to the usage method under ubuntu, that is, after entering the container, I cannot open Jupyter by opening http://0.0.0.0:8888/ . After some inquiries, I finally found the correct solution. The original jupyter's There are clear instructions in the image , but I didn't expect to go there to query!

Specific methods:
(1) Open boot2docker, enter docker-machine ip, and an IP address will be returned, for example

$ docker-machine ip myjupytermachine
192.168.99.104

(2) Open http://192.168.99.104:8888 in the browser to open jupyter
instead of http://localhost:8888 ( http://0.0.0.0:8888/ ) as in ubuntu

8. Common commands for using docker under windows

The details are similar to the usage under ubuntu, see Docker Learning Series (3): Basic instruction records and some precautions for using Docker under Ubuntu , but for the convenience of reference, here are listed separately

  • View native images
docker images
  • 1
  • 1
  • View the container running on this machine
docker ps
  • 1
  • 1
  • pull image from dockerhub
docker pull 镜像名称
  • 1
  • 1
  • Use the image to run the container:
docker run -it --rm -p 8888:8888 -v /c/Users/tingting/dropbox/code:/root/opt/workspace -v /c/Users/tingting/dropbox/data:/root/data tingtinglu/caffe_mxnet
  • 1
  • 1

(1) Use the parameter -v
(2) Before the colon is the host directory, which must be an absolute path
/c/Users/tingting/dropbox/code:
The folder of this machine The C:\Users\tingting\dropbox\codefolder of this machine (3) After the colon is the path mounted in the mirror In docker Folder Folder in docker (4) The local folder here is the c drive, so can it be the d drive? test:
/c/Users/tingting/dropbox/data
C:\Users\tingting\dropbox\data

/root/opt/workspace
/root/opt/workspace
/root/data
/root/data

docker run -it --rm -p 8888:8888 -v /d/Dropbox/code:/root /opt/workspace -v /d/Dropbox/data:/root/data tingtinglu/caffe_mxnet
  • 1
  • 1

Discovery doesn't work! This is because at present, only the folder mapping under the C drive is supported under Windows

 

http://blog.csdn.net/tina_ttl/article/details/51372604

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327095751&siteId=291194637