分类
devops

systemd.socket 和 socket-activation


Last Updated on 2022-02-18

systemd.socket 和 socket-activation

socket-activation是一种init加速技术,在一个包含了众多单元启动阶段,必然会有依赖关系,socket-activation提供了并发地启动service的机制。

Socket units may be used to implement on-demand starting of services, as well as parallelized starting of services. See the blog stories linked at the end for an introduction. 链接参考有这句话,其中parallelized starting of services就是服务的并行启动

  • IPC:Inter-Process Communication,进程间通信
  • unix domain socket
  • network socket 包含 TCP socket等等
  • network socket 5 tuple 网络套接字5元组,即本地端口、本地IP地址、远程端口、远程IP地址、协议

dockerd -H fd://

-H fd://是docker的特殊参数,需要和dockerd.socket配合使用,即socket套接字由systemd托管的情况下。

On Systemd based systems, you can communicate with the daemon via Systemd socket activation, use dockerd -H fd://. Using fd:// will work perfectly for most setups but you can also specify individual sockets: dockerd -H fd://3. If the specified socket activated files aren’t found, then Docker will exit. You can find examples of using Systemd socket activation with Docker and Systemd in the Docker source tree. 跳转参考

也就是说在不是systemd启动dockerd的情况下,是不需要配置-H fd://的,而用-H unix:///var/run/docker.sock

参考