Class: Docker::API::Network
Overview
This class represents the Docker API endpoints regarding networks.
Instance Method Summary collapse
-
#connect(name, body = {}) ⇒ Object
Connect a container to a network.
-
#create(body = {}) ⇒ Object
Create a network.
-
#details(name, params = {}) ⇒ Object
Inspect a network.
-
#disconnect(name, body = {}) ⇒ Object
Disconnect a container from a network.
-
#list(params = {}) ⇒ Object
List networks.
-
#prune(params = {}) ⇒ Object
Delete unused networks.
-
#remove(name) ⇒ Object
Remove a network.
Methods inherited from Base
Constructor Details
This class inherits a constructor from Docker::API::Base
Instance Method Details
#connect(name, body = {}) ⇒ Object
Connect a container to a network.
Docker API: POST /networks/id/connect
70 71 72 |
# File 'lib/docker/api/network.rb', line 70 def connect name, body = {} @connection.request(method: :post, path: "/networks/#{name}/connect", headers: {"Content-Type": "application/json"}, body: body.to_json) end |
#create(body = {}) ⇒ Object
Create a network.
Docker API: POST /networks/create
36 37 38 |
# File 'lib/docker/api/network.rb', line 36 def create body = {} @connection.request(method: :post, path: "/networks/create", headers: {"Content-Type": "application/json"}, body: body.to_json) end |
#details(name, params = {}) ⇒ Object
Inspect a network.
Docker API: GET /networks/id
25 26 27 |
# File 'lib/docker/api/network.rb', line 25 def details name, params = {} @connection.get(build_path("/networks/#{name}", params)) end |
#disconnect(name, body = {}) ⇒ Object
Disconnect a container from a network.
Docker API: POST /networks/id/disconnect
82 83 84 |
# File 'lib/docker/api/network.rb', line 82 def disconnect name, body = {} @connection.request(method: :post, path: "/networks/#{name}/disconnect", headers: {"Content-Type": "application/json"}, body: body.to_json) end |
#list(params = {}) ⇒ Object
List networks.
Docker API: GET /networks
13 14 15 |
# File 'lib/docker/api/network.rb', line 13 def list params = {} @connection.get(build_path("/networks", params)) end |
#prune(params = {}) ⇒ Object
Delete unused networks.
Docker API: POST /networks/prune
58 59 60 |
# File 'lib/docker/api/network.rb', line 58 def prune params = {} @connection.post(build_path("/networks/prune", params)) end |
#remove(name) ⇒ Object
Remove a network.
Docker API: DELETE /networks/id
47 48 49 |
# File 'lib/docker/api/network.rb', line 47 def remove name @connection.delete("/networks/#{name}") end |