Documentation

Java Python

Description

Nginx is a web server that can also be used as a reverse proxy, load balancer, mail proxy and HTTP cache.

Examples

Dependency:
<dependency>
    <groupId>org.testcontainers</groupId>
    <artifactId>nginx</artifactId>
    <version>1.20.0</version>
    <scope>test</scope>
</dependency>
Usage:
var nginx = new NginxContainer<>(DockerImageName.parse("nginx:1.23.4-alpine"));
nginx.start();
Dependency:
pip install testcontainers[nginx]
Usage:
with NginxContainer() as nginx:
    url = f"http://{nginx.get_container_host_ip()}:{nginx.get_exposed_port(nginx.port)}/"