Building and Sharing Images for LXC

I’m new to LXC. I’ve been experimenting with it and have been able to create containers, run web apps in containers, and put a reverse proxy on the host. It has been working great but it is all me manually typing commands in the terminal to build up the system bit by bit.

Now, I want to build a container image for a web app for simple deployment. The container will be based on Alpine Linux with Apache, mod_php, MariaDB. I want to be able to prepare a container image with all the dependencies and the web app installed and then easily deploy the image with just a few command from the host’s terminal. Perhaps something like curl to download the image tarball, unpack the tarball, run a configuration command, and finally an install command. The container/app might be deployed multiple times on a single server or on multiple servers. Each deployment will have a different domain name so the image may need to be modified slightly when it is installed. In the LXC world, is this a reasonable approach? What LXC-related technology should I be learning about to accomplish this?

Thanks and happy new year!

First of all switch to Incus. Read this comparison between LXC and LXD. Incus is a fork of LXD. One reason to choose Incus over LXD is for better access to alpine images.

I started with LXD myself, so I don’t really know the differences from LXC.

Incus has commands to publish, export, and import images. It also has a way to share images via its https interface. I prefer to share images by manual export-copy-import, so that the Incus instances are independent.