Class: Docker::API::Transport::NamedPipe
- Defined in:
- lib/docker/api/transport/named_pipe.rb
Overview
A daemon reached over a Windows named pipe, which is how Docker Desktop for Windows exposes the Engine API by default.
Windows named pipes present as files, so a binary-mode File is a bidirectional stream that behaves closely enough to a socket for the layer above. This is the transport the docker-api gem never grew, which is why kitchen-dokken carries a standing TODO about Windows support.
Constant Summary collapse
- DEFAULT_PIPE =
The pipe Docker Desktop for Windows publishes by default.
"//./pipe/docker_engine"
Instance Attribute Summary collapse
-
#path ⇒ String
readonly
The pipe path.
Instance Method Summary collapse
-
#connect ⇒ IO
The opened pipe.
-
#initialize(path: DEFAULT_PIPE) ⇒ NamedPipe
constructor
A new instance of NamedPipe.
- #to_s ⇒ String (also: #inspect)
Methods inherited from Base
Constructor Details
#initialize(path: DEFAULT_PIPE) ⇒ NamedPipe
Returns a new instance of NamedPipe.
24 25 26 27 |
# File 'lib/docker/api/transport/named_pipe.rb', line 24 def initialize(path: DEFAULT_PIPE) super() @path = path end |
Instance Attribute Details
#path ⇒ String (readonly)
Returns the pipe path.
21 22 23 |
# File 'lib/docker/api/transport/named_pipe.rb', line 21 def path @path end |
Instance Method Details
#connect ⇒ IO
Returns the opened pipe.
31 32 33 34 35 36 37 |
# File 'lib/docker/api/transport/named_pipe.rb', line 31 def connect dial("npipe://#{path}") do pipe = File.open(windows_path, "r+b") pipe.sync = true pipe end end |
#to_s ⇒ String Also known as: inspect
40 41 42 |
# File 'lib/docker/api/transport/named_pipe.rb', line 40 def to_s "#<Docker::API::Transport::NamedPipe path=#{path}>" end |