Create compose file based on running container

I have a comtainer with Homeassistant running. This application is quite outdated and I would like to update it to the latest version.

I have deployed several apps through docker-compose scripts, but unfortunately I cannot find the script I used to deploy HA with.

In Portainer I can see certain settings, of the container, such as mapped volumes and the network it is running in.

Is there a way to create a compose file based on a running config?
Or do I need to create a new script, map the volume/network and test if it works?

1 Like

IF you have Compose v2 then docker compose ls can show you the known compose paths, but even before compose v2 containers had labels which you can see if you run

docker container inspect CONTAINERNAME

and search for “labels” in the output.

If you already deleted the files you can try to find something like this:

I always forget what @meyay showed me as I never needed it.

1 Like

That is helpfull and will definitely usefull to get my compose file. Thank you very much.