Migrating AWS instance to Docker image

I have deployed an application to a AWS instance via chef.
Is there a way to migrate the the instance to a Docker image?

Not automatically.

I’d figure out your dependencies and write a Dockerfile.

Too complicated to figure out the dependencies. I am considering using Packer for that purpose.

It’s generally not operationally sound to run applications if you aren’t sure how they are even running in the first place.

Maybe instance snapshots will work for your use case, but what are you going to do when one of your application’s dependencies has a critical security bug and you need to update it?

I am not going to use Docker in a production system. My plan is to use it for demoing solutions to my clients. Right now I have chef recipes which are used to create an AWS instance with the application deployed.

Sure, but why not simply transpose the Chef cookbooks into a Dockerfile and build the image that way?

For a quick hack, you might even be able to apply them in a container using something like chef-solo. This is not usually ideal because it requires bundling all of the stuff neccessary to run Chef stuff in the container, but might get the job done quickly in a pinch.

That said, if it requires spinning up multiple processes such as a web app + caching layer + database, you probably want to look into writing a docker-compose.yml to describe the individual services as well.

The issue is that I have invested lots of efforts in developing a cookbook which deploys the application, setup and configure it. It would be a huge effort from me to convert it to a Dockerfile. I will do that if this is my only valid option.
After digging into packer, it seems as a feasible solution to reuse its capabilities provisioning a docker container with a chef server builder.