docker的registry里有nginx: https://registry.hub.docker.com/_/nginx/ 但我觉得必要性不大。修改:有必要。我忘了服务器会坏了。:-) 物理服务器出事时可以换台服务器快速恢复。When a container migrates from one node to another, all the clocks are restored to their consistent states.

https://www.nginx.com/resources/wiki/start/topics/tutorials/commandline/

/usr/bin/nginx -t -c ~/mynginx.conf -g "pid /var/run/nginx.pid; worker_processes 2;"

可以同时运行多份nginx,它们的配置文件不同。有同时运行多个不同版本的nginx的必要吗?

nginx装起来不方便吗?不讲究的话apt install nginx就完事了,即安装distribution-provided. Debian,Ubuntu等都是distribution。
装最时新的有一点点啰嗦,如: https://nginx.org/en/linux_packages.html#Ubuntu
但起码stable和mainline是"或"的关系——看起来挺多的步骤其实没有那么多。

按官网上的说明下载源码自己编译也不麻烦,我干过。

Docker: What's Under the Hood? https://www.codementor.io/blog/docker-technology-5x1kilcbow

Docker使用Union File System. The union file system is a file system service for Linux, FreeBSD, and NetBSD that implements a union mount for other file systems. It allows files and directories of separate file systems, known as branches, to be transparently overlaid, forming a single coherent file system.

Docker uses the union file system to create and layer Docker images. This means all images are built on top of a base image, actions are then added to that base image.

比如说Ubuntu 1GB, XXX 100MB。带XXX的Ubuntu和不带XXX的Ubuntu两个image,不用下载1GB + 1.1GB,而是1GB + 0.1GB.

chroot历史很悠久了。https://www.linuxfordevices.com/tutorials/linux/chroot-command-in-linux

抄自"Linux Containers and Virtualization A Kernel Perspective by Shashank Mohan Jain": A namespace controls which resources within the kernel a process can see. Namespace types are:

1. UTS isolates the hostname and the NIS domain name. UTS (UNIX Time Sharing) is named after the data structure used to store information returned by the uname system call. 
2. PID. The processes within the PID namespace have a different process tree. They have an init process with PID 1.
3. Mount. A bind mount allows a directory instead of a device to be mounted.
4. Network. A network namespace gives a container a separate set of network subsystems (interfaces, routes, iptables etc).
5. IPC. Inter-Process-Communication, e.g. message queues.
6. cgroups. Control groups allow processes to be organized into hierarchical groups whose usage of various types of resources can then be limited and monitored.
7. Time. When a container migrates from one node to another, all the clocks are restored to their consistent states. In other words, they continue running from the same point where they were dumped.

虚拟化 - xen、kvm、vmware、hyper-v等虚拟化技术的比较 - SammyLiu - 博客园

QEMU是emulator and virtualizer. 它可以在x86下跑mips,此时是emulator,就不讲究性能了: 解释执行mips的机器码。它也可以是virtualizer,如x86 linux下跑x86 linux,这就大有讲究了,像什么popf指令影响eflags寄存器,而eflags寄存器里有一位是关中断的;ring 0, 1, 3; vt-x指令等等。QEMU当virtualizer时和kvm (kernel virtual machine)配合使用。

posted on 2022-01-06 09:41  华容道专家  阅读(2434)  评论(0)    收藏  举报