Sign inSign up

n8500x/haproxy-lua

By n8500x

Updated 20 days ago

HAProxy (lts-alpine) with Lua + LuaSec (ssl.https) for HTTPS from Lua scripts

Image
0

194

n8500x/haproxy-lua repository overview

haproxy-lua

HAProxy on Alpine with Lua 5.3 and LuaSec, so Lua scripts running inside HAProxy can make outbound HTTPS calls (ssl.https).

Overview

This image extends the official haproxy:lts-alpine3.21 image and adds a Lua 5.3 runtime plus the LuaSec library. LuaSec provides the ssl.https module, which lets Lua scripts loaded into HAProxy (via lua-load) perform TLS/HTTPS requests. The stock HAProxy image ships Lua but not LuaSec, so plain Lua can only do HTTP; this image fills that gap.

It is published to two Docker Hub repositories from the same build:

  • n8500x/haproxy-lua-alpine
  • n8500x/haproxy-lua (equivalent tag / alias)

Quick start

# Pull (alpine-based)
docker pull n8500x/haproxy-lua-alpine
# Equivalent alias:
# docker pull n8500x/haproxy-lua

# Run with your own haproxy.cfg
docker run -d \
  --name haproxy-lua \
  -p 80:80 \
  -v "$(pwd)/haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro" \
  n8500x/haproxy-lua-alpine

/usr/local/etc/haproxy/haproxy.cfg is the standard configuration path inherited from the official HAProxy base image. Mount your Lua scripts into the container as well and reference them from the config with lua-load, for example:

global
    lua-load /etc/haproxy/lua/myscript.lua
docker run -d \
  -p 80:80 \
  -v "$(pwd)/haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro" \
  -v "$(pwd)/lua:/etc/haproxy/lua:ro" \
  n8500x/haproxy-lua-alpine

What's inside

  • Base image: haproxy:lts-alpine3.21 (HAProxy LTS on Alpine 3.21).
  • lua5.3 — Lua 5.3 interpreter.
  • lua-socket — LuaSocket, the networking layer LuaSec builds on.
  • lua-sec and the luasec LuaRocks package — LuaSec, providing ssl.https for HTTPS requests from Lua.
  • Build/runtime toolchain used to compile the LuaSec rock: lua5.3-dev, openssl-dev, gcc, musl-dev, luarocks5.3.
  • figlet — banner/text utility.

Configuration

The Dockerfile itself does not add an EXPOSE, custom entrypoint, or config file — it inherits all runtime defaults from the official HAProxy base image:

  • Config path: /usr/local/etc/haproxy/haproxy.cfg (base image default).
  • Ports: none are exposed by this image; publish whatever ports your haproxy.cfg binds (e.g. -p 80:80).

Packages are installed as root during build (USER root).

Build

docker build -t n8500x/haproxy-lua-alpine ./haproxy

Notes

  • LuaSec is installed both via Alpine's lua-sec package and via luarocks-5.3 install luasec; the LuaRocks build is what guarantees an ssl.https-capable module for Lua 5.3.
  • The image switches to USER root for package installation and does not switch back, so it runs as root unless you override the user at runtime.
  • HTTPS calls from Lua depend on CA certificates being present/trusted inside the container. In TLS-intercepted or air-gapped environments you may need to supply or trust the appropriate CA bundle.
  • Provide your own haproxy.cfg; the image does not bundle an application configuration.

Tag summary

Content type

Image

Digest

sha256:291023c98

Size

22.9 MB

Last updated

20 days ago

docker pull n8500x/haproxy-lua