The top-level module for this gem. It's purpose is to hold global configuration variables that are used as defaults in other classes.
The version of the compatible Docker remote API.
The version of the docker-api gem.
Login to the Docker registry.
# File lib/docker.rb, line 83 def authenticate!(options = {}, connection = connection) creds = options.to_json connection.post('/auth', {}, :body => creds) @creds = creds true rescue Docker::Error::ServerError, Docker::Error::UnauthorizedError raise Docker::Error::AuthenticationError end
# File lib/docker.rb, line 64 def connection @connection ||= Connection.new(url, options) end
# File lib/docker.rb, line 33 def default_socket_url 'unix:///var/run/docker.sock' end
Get more information about the Docker server.
# File lib/docker.rb, line 78 def info(connection = self.connection) Util.parse_json(connection.get('/info')) end
# File lib/docker.rb, line 59 def options=(new_options) @options = new_options reset_connection! end
# File lib/docker.rb, line 68 def reset_connection! @connection = nil end
# File lib/docker.rb, line 41 def url @url ||= ENV['DOCKER_URL'] || ENV['DOCKER_HOST'] || default_socket_url # docker uses a default notation tcp:// which means tcp://localhost:2375 if @url == 'tcp://' @url = 'tcp://localhost:2375' end @url end
# File lib/docker.rb, line 54 def url=(new_url) @url = new_url reset_connection! end
When the correct version of Docker is installed, returns true. Otherwise, raises a VersionError.
# File lib/docker.rb, line 94 def validate_version! Docker.info true rescue Docker::Error::DockerError raise Docker::Error::VersionError, "Expected API Version: #{API_VERSION}" end
Get the version of Go, Docker, and optionally the Git commit.
# File lib/docker.rb, line 73 def version(connection = self.connection) Util.parse_json(connection.get('/version')) end
Generated with the Darkfish Rdoc Generator 2.