portainer lost stack/ compose

  • I recently updated my Portainer version through the OMV Web GUI. Afterwards my compose files/ stack files were gone in Portainer.

    Portainer says: "This stack was created outside of Portainer. Control over this stack is limited."


    All containers are working fine. How could i get them back?

    - OMV7 on Asus Prime N100 -

    Snapraid on 2 Data drives & 1 Parity

    latest proxmox kernel

    • Official Post

    I'm guessing your portainer volume changed somehow and it lost your stacks? One way to prevent this, is install portainer with docker-compose.


    mkdir portainer

    cd portainer

    touch docker-compose.yml

    nano docker-compose.yml


    Paste the following:


    Cntrl X, then Y, then Enter to save

    docker-compose up -d


    When it's done, you can log back into portainer. You still won't have your stacks obviously, but if this ever happens again, just redploy the compose file and make sure the :data folder is configured... and you'll be fine. Done this several times

  • Thanks.

    Actually i already have a fix volume path for data in my portainer config. I did not do this via compose but manually in portainer config. Should be exactly the same. The container also actually uses the volume. When manually navigatin into the "_data/compose" subfolder of the portainer volume, the "compose" folder is empty....


    - OMV7 on Asus Prime N100 -

    Snapraid on 2 Data drives & 1 Parity

    latest proxmox kernel

    Edited 3 times, last by monsen ().

  • monsen what you are doing is different from waht KM0201 suggested. You are using a docker volume and must not write to the underlying directory from cli. Docker manages this volume it is is to be accessed from inside an container only.


    Did you remove the docker volume before you updaed? If yes, all your config files in this volume are gone. You can use docker inspect <container_name> to get the config and transform into new stacks.


    What do you mean with this sentence?

    I did not do this via compose but manually in portainer config.

    If you install portainer throug the omv-extras ui it will be set up like you showed.

    If you got help in the forum and want to give something back to the project click here (omv) or here (scroll down) (plugins) and write up your solution for others.

  • monsen what you are doing is different from waht KM0201 suggested. You are using a docker volume and must not write to the underlying directory from cli. Docker manages this volume it is is to be accessed from inside an container only.

    Ok i understand.


    Did you remove the docker volume before you updaed? If yes, all your config files in this volume are gone. You can use

    No i did not


    What do you mean with this sentence?

    If you install portainer throug the omv-extras ui it will be set up like you showed.

    Ok I thought i might have done this as i have done many docker configs and i might have forgotten.

    - OMV7 on Asus Prime N100 -

    Snapraid on 2 Data drives & 1 Parity

    latest proxmox kernel

  • Ok I now loaded an old backup of my OMV installation. The stacks are all in there fine.

    Should i just copy the stack scripts from there or is there a better way to make sure the stacks will work fine in the updated portainer installation?

    - OMV7 on Asus Prime N100 -

    Snapraid on 2 Data drives & 1 Parity

    latest proxmox kernel

  • Portainer keps the stacks as docker-compose.yml files. You can start a container, mounting al local directory and the portainer_data volume and copy the contenst to your local file system.


    I did it like this:;

    Code
    root@omv:~# mkdir portainer                      # make directory to copy the files to
    root@omv:~# docker run --rm -it -v portainer_data:/portainer -v $(pwd)/portainer:/local ubuntu   # spin up a ubuntu container
    root@99c71bbae130:/# cp -rp /portainer/* /local/ # copy the file to local
    root@99c71bbae130:/# exit                        # exit the container
    exit
    root@omv:~#



    Now all portainer files are in ./portianer in the host.

    If you got help in the forum and want to give something back to the project click here (omv) or here (scroll down) (plugins) and write up your solution for others.

  • But doing a normal upgrade should not delete the portainer_data volume. Did you move the docker directory during the upgrade?

    If you got help in the forum and want to give something back to the project click here (omv) or here (scroll down) (plugins) and write up your solution for others.

  • Couldn't i just navigate to the portainer_data folder on CLI and copy the contents from there?


    I have just checked the "compose" folder under there and it also is empty. So seems like these are stored elsewhere.


    But doing a normal upgrade should not delete the portainer_data volume. Did you move the docker directory during the upgrade?

    No. I did not move anything. The stacks were gone after the update. Nothing done on my end.


    On a side note: I don't think the portainer_data folder has been deleted. Something else happened. Everything else is there and active. The containers that are part of the stack are up and running with correct config.

    - OMV7 on Asus Prime N100 -

    Snapraid on 2 Data drives & 1 Parity

    latest proxmox kernel

    Edited 2 times, last by monsen ().

  • The docker-compose.yml files are only "configuration files" teling docker how to create docker containers. The state of running containers is stored by docker itself. If you shut down docker and restart, it will restart the containers which were running when you shut down the daemon.

    This is what you see.


    You can not directly copy the files from the directory you found, but can cut and paste the commands I gave above, one at a time.

    If you got help in the forum and want to give something back to the project click here (omv) or here (scroll down) (plugins) and write up your solution for others.

  • Ok i thought the files might be accessible via folder structure.

    I get your above commands. You are mounting the newly created folder and the portainer_data folder inside of an ubuntu container.

    Then i guess we can log into that ubuntu system and copy the contents from one to another folder. So straight forward.

    - OMV7 on Asus Prime N100 -

    Snapraid on 2 Data drives & 1 Parity

    latest proxmox kernel

  • The command starts an ephermal continer and gets you direcly into a bash shell inside the container.

    The rest is obvious, just copying files and then leaving the container (wich stops, destroies and removes the container --rm flag)

    If you got help in the forum and want to give something back to the project click here (omv) or here (scroll down) (plugins) and write up your solution for others.

  • Yes, the above is a 1:1 transcript from my shell window.

    If you got help in the forum and want to give something back to the project click here (omv) or here (scroll down) (plugins) and write up your solution for others.

  • Ok i found the root cause of this trouble and was able to fix it differently.

    Sometime back there was a different folder structure in openmediavault.

    My Portainer data folder was formerly stored in "/sharedfolders/Appdata" and this is where it resided up to here.

    Seems like the path was overwritten by some kind of OMV internal process to the new path in /var/lib/docker/volumes....".


    I fixed this by copying the contents of the old folder to the new path. Now everything is fine again.

    - OMV7 on Asus Prime N100 -

    Snapraid on 2 Data drives & 1 Parity

    latest proxmox kernel

  • monsen

    Added the Label resolved
  • monsen

    Added the Label OMV 6.x (RC1)

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!