I'm using docker for my own applications. I'd like to standardize my deployments, including apps that are not my own and not 12 factor. Docker hub is full of every application imaginable but most of just experiments that suggest not running in production as the state is not saved and upgrades are questionable. It's actually not that hard to run random things with state in Docker using volumes. I'll use Moodle as an example and assume it's already running on a non docker environment.
1. Identify anything with state. For Moodle that's the moodle code itself (contains config.php and moodle updates). Then the moodle data directory that I defined at installation. And the database.
2. Create a Dockerfile based on what technology is driving the application. Moodle is php, so I'll use the docker php repository. Sadly these files have little documentation - I found the docker-php-ext-install stuff by chance. These files might actually cause more confusion so feel free to just use the ubuntu or whatever linux distribution you are more familiar with.
Port 8050 is just what I happened to select as an internal port. The host server has nginx that will redirect here. Deploying docker in production is out of scope on this guide though. The important thing here is mounting those volumes.
4. Drop in data - I copied both my moodle and moodledata folders from the previous server. Keep in mind the idea here is that changes to the container are saved on the host machine.
5. I'll configure my application (moodle has a config.php) I'll adjust the moodledata directory if needed and set my database up. The database is not hosted via docker. Again nothing stateful is in Docker.
Run the docker container and your app should load. In my case the Docker image I pulled from contains apache that is set to run /var/www/html/ which is now my mounted volume containing moodle. If I wanted to upgrade moodle I could do so the normal way. Even an application like wordpress that downloads the application files itself would work fine - well unless they decide to change the application directory.
Docker doesn't need to the hammer for every nail. lxc or virtualization might make more sense in this use case. However this standardizes things and allows me to move the container to a new server effortlessly.