Table of contents
So why do we use docker instead of virtual machines?
docker resource consumption will be less
docker has the simplicity of one-click deployment
The ease of uninstalling docker
The limitations of docker compared to virtual machines
The isolation of docker is not as good as that of virtual machine
Docker is not as secure as a virtual machine
Introduction to some docker projects
Introduction to docker
what is docker
Docker is a platform for free development, packaging, and running programs based on the linux kernel. Docker allows us to separate programs from the environment so as to quickly migrate our projects. Through Docker, managing our applications is as easy as managing our environment (I don’t think any of them is easy in actual development, for me who just graduated), and we can quickly package, test, and deploy our code by using docker technology , you can significantly reduce the time spent writing code and running it in production.
He is the beginning that really made me realize the convenience of linux
In a simple and narrow sense, docker is a lightweight virtual machine
So why do we use docker instead of virtual machines?
Startup advantage
The startup speed of docker is much faster than that of virtual machine
docker resource consumption will be less
Docker performs virtualization at the operating system level, and the utilization rate of its interaction with the hardware core is almost 100%
However, the virtualization of the Hypervisor layer and the kernel layer can sometimes only reach 50%.
docker has the simplicity of one-click deployment
Most docker projects only need one command to perfectly install the image provided by others
No need to install other dependencies again
The ease of uninstalling docker
Compared to installing a bunch of junk software on the system and then difficult to remove (especially the linux system)
Docker is a very simple form of installation and uninstallation
docker portability
Not only can you download other people's mirrors, but you can also publish your own mirrors for others to use.
Others can also use a few pieces of code to pull the image you made
The limitations of docker compared to virtual machines
The isolation of docker is not as good as that of virtual machine
Compared with virtual machines isolated by the system, docker is only an isolation between processes.
Docker is not as secure as a virtual machine
Due to the isolation of docker, it is not as safe as a virtual machine when he tests some malware
Introduction to some docker projects
grown up
introduce
This project can mount almost any network disk on the market (Baidu cloud disk, Alibaba cloud disk, 123 cloud disk...)
And you can mount Alibaba Cloud video to a local folder through webdav, and then play it through emby to build your own private theater
Or you can also cooperate with aria2 to achieve a fast download link for network disk files. For example, the download speed of Ali cloud disk on my computer is 10m/s when using the client, while aria2 can achieve a download speed of 30m/s
deployment command
docker run -d --restart=always -v 你缓存的文件夹位置:/opt/alist/data -p 5244:5244 --name="alist" xhofe/alist:latest
Run the following command to get the password
docker exec -it alist ./alist admin
The website is on the server ip:5244
nextcloud
introduce
It is a private cloud disk service, and can provide various functions such as downloading, uploading, and mounting (PS: If the private cloud disk is built on the intranet, as long as the network port configuration is not too bad, the transmission rate between the intranets is Very very fast, my side is 60m/s, and it does not occupy the broadband of other computers in the LAN)
deployment command
docker run -d --restart=always --name nextcloud -p 80:80 -v /root/nextcloud:/data rootlogin/nextcloud
The website is on the server ip:80
Here I want to explain that among the 80:80, the first 80 can be changed (the latter is absolutely not) to 81.
The website is on the server ip:81
Dragon panel
introduce
This is also the first project I came into contact with docker. It can regularly execute some small tasks of pyhton or nodejs
For example, the most famous one is JD.com's automatic timing of wool (Jingdou, red envelopes)
and scripts like automatic check-ins
deployment command
docker run -dit \
-v $PWD/ql/config:/ql/config \
-v $PWD/ql/log:/ql/log \
-v $PWD/ql/db:/ql/db \
-v $PWD/ql/repo:/ql/repo \
-v $PWD/ql/raw:/ql/raw \
-v $PWD/ql/scripts:/ql/scripts \
-v $PWD/ql/jbot:/ql/jbot \
-p 5700:5700 \
--name qinglong \
--hostname qinglong \
--restart unless-stopped \
whyour/qinglong:latest
Net Heart Cloud
introduce
If you have idle broadband at home and often don’t use it at night because of overtime work or use very little broadband most of the time, you might as well try to use idle broadband to earn some pocket money (after a week, the average 100m uplink is 5 yuan a day, and you can spend the broadband money Earn it back, but if you play some games during the peak hours at night, it will become more laggy)
deployment command
docker pull registry.hub.docker.com/onething1/wxedge
docker run -d --name=wxedge --restart=always --privileged --net=host --tmpfs /run --tmpfs /tmp -v 磁盘路径:/storage:rw registry.hub.docker.com/onething1/wxedge
kodbox (Kodao Cloud)
introduce
This is also a private cloud disk, but compared to nextcloud, its built-in pdf reader is very good, and its desktop system is also very convenient to operate. The disadvantage is that it does not have the powerful offline download function of nextcloud, although it is optimized. reach the appropriate level
deployment command
docker run -d --name kodbox --restart=always -v 你云盘存放文件的目录:/var/www/html -p 80:80 aeert/kodbox:latest
It’s still the same as the old 80:80 command line, you can just change it (don’t take up the port)
pagoda
introduce
Baota is a free server management panel, which provides a simple and easy-to-use graphical interface, which can help users quickly install, configure and manage various applications on the server, such as Web server, database, FTP, etc. . Pagoda supports a variety of operating systems and software environments, including Linux, Windows, Nginx, Apache, MySQL, PHP, and more. Its functions are very powerful, including website management, FTP management, database management, file management, log management, security management, etc., and the interface design of the pagoda is also very beautiful and easy to use.
He can easily build some websites and deploy some websites with one click
The interesting thing is that you can also install docker again in the pagoda to dolls
deployment command
docker pull ubuntu
docker run -i -t -d --name bt -p 2000:20 -p 2100:21 -p 8000:80 -p 4430:443 -p 8880:888 -p 8888:8888 --privileged=true -v 宝塔中网站的挂载的本地目录:/www/wwwroot ubuntu
docker exec -it bt /bin/bash
apt-get update
apt-get -y install sudo
apt-get -y install wget
wget -O install.sh https://download.bt.cn/install/install-ubuntu_6.0.sh && sudo bash install.sh ed8484bec
Finally, enter bt 14 to view the URL of the website management (different ports for different computers)
Summarize
As a tool, docker has extremely simple deployment and transplantation operations, and it can stimulate learning interest for some people who are just getting started with linux, and learn through constant attempts and curiosity.