class

Testcontainers::NginxContainer

Inherits Testcontainers::DockerContainer < Reference < Object

NginxContainer provides a pre-configured container for Nginx.

Example:

container = Testcontainers::NginxContainer.new
container.start

url = "http://#{container.host}:#{container.mapped_port(80)}"

container.stop
container.remove

Constants

NGINX_DEFAULT_IMAGE = "nginx:latest"
NGINX_DEFAULT_PORT = 80

Constructors

new(image : String = NGINX_DEFAULT_IMAGE)
Source

Instance methods

base_url(protocol : String = "http") : String

Returns the base URL for the Nginx instance.

Source
port
Source
start

Starts the container.

This will:

  1. Pull the image if not present
  2. Create the container
  3. Start the container
  4. Execute the wait strategy (if any)

Returns self for method chaining.

Source