Dockerization of Neverwinter Nights dedicated server v169
I strongly recommend running with docker-compose to manage the run configurations, the github repository contains an example docker-compose.yml. If docker-compose is not an option then you will have to specify ports (both udp and tcp), volumes, and the run arguments to nwserver. The below should work as long as the paths are adapted to match the host machine environment.
docker run -d -p5121:5121/tcp -p5121:5121/udp --rm \ -v /opt/nwn/data:/opt/nwnserver/data \ -v /opt/nwn/erf:/opt/nwnserver/erf \ -v /opt/nwn/hak:/opt/nwnserver/hak \ -v /opt/nwn/modules:/opt/nwnserver/modules \ -v /opt/nwn/servervault:/opt/nwnserver/servervault \ -v /opt/nwn/tlk:/opt/nwnserver/tlk \ jakkn/nwnserver:slim bash -c "./nwserver -publicserver 1 -servername \"Containerized nwnserver\" -dmpassword dmpw -oneparty 0 -pvp 0 -difficulty 2 -elc 1 -reloadwhenempty 0 -module \"yourmodule\" -maxclients 32 -servervault 1 -maxlevel 40 -gametype 0 -autosaveinterval 0"
Based on i386/ubuntu, the image contains nwndedicatedserver1.69. The latest and slim image has had the /opt/nwnserver/data folder removed to reduce the image size, bringing it down from 1.98GB (full) to 180MB (slim, latest).
Mounting a folder that contains a Neverwinter Nights module file (for instance module.mod) to /opt/nwnserver/modules is necessary for container to run. Also make sure to mount the nwn/data folder from the host machine when using slim and latest. Use jakkn/nwnserver:full when the host machine does not have the nwn/data folder locally.
For ideas on how to use this image for local testing with your own projects, see jakkn/nwn-devbase.