A lightweight Docker container based on Ubuntu 24.04 with OpenResty, Lua 5.4, and lua-resty-http pre-installed and configured.
docker build -t openresty-lua .
docker run -p 80:80 openresty-lua
The container will start OpenResty and expose it on port 80.
Once the container is running, you can access the following endpoints:
http://localhost/ - Welcome page with container informationhttp://localhost/lua - Basic Lua functionality testhttp://localhost/test-http - Verifies lua-resty-http installation/etc/openresty/nginx.conf - Main OpenResty configuration/etc/openresty/conf.d/default.conf - Default server configuration with Lua support/var/log/openresty/access.log/var/log/openresty/error.log/usr/share/nginx/html/To add additional Lua libraries, you can use the OpenResty Package Manager (opm):
RUN /usr/local/openresty/bin/opm get <author>/<package-name>
To add your own configuration:
Mount your configuration files:
docker run -v /path/to/your/conf:/etc/openresty/conf.d -p 80:80 openresty-lua
Or extend the Dockerfile with your custom configurations using COPY instructions.
The container includes sample Lua endpoints in the default configuration:
location /lua { default_type 'text/plain'; content_by_lua_block { ngx.say("Hello, Lua from OpenResty!") } }
DEBIAN_FRONTEND=noninteractive - Prevents interactive prompts during package installationTZ=UTC - Sets timezone to UTCThe container exposes port 80. Use the following mapping to access it:
docker run -p 8080:80 openresty-lua # Maps container port 80 to host port 8080
For production deployments, consider:
docker run -d \ --name openresty-app \ -p 80:80 \ -v /path/to/logs:/var/log/openresty \ -v /path/to/config:/etc/openresty/conf.d \ --restart unless-stopped \ openresty-lua
docker logs <container-id>
docker exec -it <container-id> /bin/bash
docker exec <container-id> openresty -t
docker exec <container-id> openresty -s reload
This Docker image is provided as-is for development and testing purposes.