1. Docker installation
Docker supports the following installations: Ubuntu, centos, windows, Mac os (for detailed tutorials, please search online by yourself, this blog has reached a strategic cooperation with Baidu and other websites that you know how to search, and pay attention to the problem of mirror replacement)
Ubuntu supports the following versions:
- Ubuntu Precise 12.04 (LTS)
- Ubuntu Trusty 14.04 (LTS)
- Ubuntu Wily 15.10
- Later version (Docker requires Ubuntu kernel higher than 3.10)
Centos supports the following versions:
- CentOS 7 (64-bit)
- CentOS 6.5 (64-bit)
- Higher version
Docker runs on CentOS 7 and requires the system to be 64-bit and the system kernel version to be 3.10 or higher.
Docker runs on CentOS-6.5 or higher versions of CentOS, and requires the system to be 64-bit and the system kernel version to be 2.6.32-431 or higher.
Windows supports the following versions:
- Windows7
- Windows8
- Higher version
Mac os supports the following versions:
Mac os is just Mac os
2. Easy to use HelloWorld
Everyone likes to use Hello World to test whether Docker can be used normally. In fact, Hello World is actually used to run an application such as Hello World in a container, and the code (I use Ubuntu: 18.10):
docker run ubuntu:18.10 /bin/echo "Hello world"
We explain these parameters:
docker: execute file;
run: run;
ubuntu18.10: The image you want to run, first Docker will look for it locally, if not, it will pull it;
/ bin / echo "Hello World": execute the Hello World command in the started container
This picture is a pull image
3. Simple operation
1. Create a container
docker run -i -t ubuntu:18.10 /bin/bash
Parameter explanation:
-t means to specify a terminal in the container, -i means you can interactively input commands to the container
To exit, type exit or CTRL + D
2. Start and stop a container
First create a container
我们可以使用docker ps来查看CONTAINER ID(容器ID)和NAMES(自动分配的容器名称)
我们可以使用docker logs命令,查看容器内的输出内容
停止时,使用docker stop +容器ID/容器名称即可