I created a container with a comprehensive list of volumes, network maps and environment variables.

Is there any way Portainer exports the container configuration or provide a Docker CLI command to create such container?

  • thekrautboyB
    link
    fedilink
    English
    arrow-up
    4
    ·
    1 year ago

    https://github.com/Red5d/docker-autocompose

    Generates a docker-compose yaml definition from a docker container.

    For the future you should get started by using compose files from the beginning, and keep those as your “backup” of the container config. Exporting them from a deployed container is not the intended approach.

  • CameronDev@programming.dev
    link
    fedilink
    English
    arrow-up
    1
    ·
    edit-2
    1 year ago

    I dont know if it can now, but it definitely couldnt a few years ago, and i havent seen anything for it recently.

    When i had the same issue, i tried this:

    ~~https://www.makeuseof.com/create-docker-compose-files-from-running-docker-containers/~~

    Edit: link has a very aggressive anti adblock, but the script is python-autocompose which the other poster has linked.

    It didnt work then, just generating a very basic outline, but maybe it has improved.

    On the upside, this is a mistake youll only make once, I just use compose for everything now, saves a lot of hassle down the line.