I run my Minecraft installation in an LXC container. That way I can keep it all separate from other stuff.
But when you install Minecraft in a container, users won't be able to connect to it until you do the following thing.
What you have to do after you install Minecraft in a server running as an LXD container is to proxy port 25565 of the container to the outside world. Yeah, that's right, since it's running in a container, it's ports and network interface aren't' available to users trying to connect from various places on the internet.
So all you need to do is connect the port 25565 of your LXD container to the server that is running the container (or something like that).
Here's what you do.
- Run lxc list so you can get the IP address of your container that runs Minecraft. (we're talking the IP version four address here, the numbers separated by dots)
- Now run lxc config device add mycontainer myport25565 proxy listen=tcp:0.0.0.0:25565 connect=tcp:127.0.0.1:25565 and that will proxy all connections from your container that runs Minecraft through the real server and to the outside world.
I learned this from Simos' answer here.