Search code examples
dockerdocker-for-windowswindows-subsystem-for-linuxdocker-desktop

What is `docker serve` command


Sometimes in WSL distributions that I've marked to enable for "integration" I can see process with:

docker serve --address /root/.docker/run/docker-cli-api.sock

docker serve --help states it's "Start an api server". This socket seems implement non-http-based protocol unlike standard /var/run/docker.sock.

I can't find any references.


Solution

  • This search on GitHub pointed me to the source code. It seems to open several different servers for Docker components here and then start a grpc server:

        composev1.RegisterComposeServer(s, p)
        containersv1.RegisterContainersServer(s, p)
        contextsv1.RegisterContextsServer(s, p.ContextsProxy())
        streamsv1.RegisterStreamingServer(s, p)
        volumesv1.RegisterVolumesServer(s, p)
        
        ...
    
        // start the GRPC server to serve on the listener
        return s.Serve(listener)
    

    Sorry, I have not found any reference or documentation for this and hope this is at least slightly helpful.