One, Docker server creation process
Docker server is an important part of Daemon server that receives requests sent by Docker client and implements the requested routing distribution according to the appropriate routing rules, eventually returning the result of the request processing to the Docker client.
Docker daemon starts, creates and runs the Serverapi job at the end of Maindaemon (), and lets Docker daemon provide API access services.
The entire lifecycle of Docker server
1. Create a job for Docker server
2. Configure the job's environment variables
3. Trigger Execution Job
Description: The code analyzed in this article is Docker version 1.2.0. (i) create "Serverapi" job
/docker/daemon.go /docker/daemon.go
Func Maindaemon () {...//Serve API job: = Eng. Job ("Serveapi", flhosts ...) ... } |
When you run a SERVERAPI job, the job's processing method is executed Api.serveapi. (ii) Configuring Job environment Variables /docker/daemon.go
job. Setenvbool ("Logging", true) job. Setenvbool ("Enablecors", *flenablecors) job. Setenv ("Version", dockerversion.) VERSION) job. Setenv ("Socketgroup", *flsocketgroup) job. Setenvbool ("Tls", *fltls) job. Setenvbool ("tlsverify" |