Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Where are the Stack compose files saved? #3522

Closed
nicedevil007 opened this issue Jan 22, 2020 · 8 comments
Closed

Where are the Stack compose files saved? #3522

nicedevil007 opened this issue Jan 22, 2020 · 8 comments
Labels
kind/question Questions on the platform

Comments

@nicedevil007
Copy link

hey guys,

just want to ask where I can find the docker-compose.yml's if I deploy my stacks with the webGui?
I tryed saving the data volume of portainer and transfer it to a new host and then deploy the same portainer stack file and all my "old" stacks aren't there anymore.

Is there a possibility to extract them to github everytime I change them or maybe just extract them to the data volume?

Thank you all in advance.

Portainer 1.23.0 is used.

@ghost
Copy link

ghost commented Jan 23, 2020

Are you managing the same endpoint with the new Portainer instance? If not, then your old stacks will not be listed inside of Portainer as you haven't migrated them also. If you can see your stacks, but they are showing as limited this is because Portainer couldn't find the corresponding stack file and could possibly be due to how you have mounted your volume.

I can't give you instructions on how to migrate as we don't have any official instructions for this.

To answer your question: Inside the /data directory there is a directory called compose which is where the stack files are stored. Inside /compose, there will be directories labelled after the corresponding stackID in the Portainer database. You will have for example /data/compose/1/docker-compose.yml, /data/compose/2/docker-compose.yml ...

@ghost ghost added the kind/question Questions on the platform label Jan 23, 2020
@ghost
Copy link

ghost commented Jan 23, 2020

Hope this helps

@nicedevil007
Copy link
Author

perfect! That was what I was looking for :)

@pconwell
Copy link

pconwell commented Dec 5, 2020

As this is one of the first search results that comes up on google when looking for the location of stack compose files, here is the location for a "standard" install on linux:

/var/lib/docker/volumes/portainer_data/_data/compose/

@MichaelMichaelMichaelMichaelMichael

What would I have to restart from the outside in order to reload a compose file?
Should I just issue a docker-compose up -d in the respective directory?

@denzfarid
Copy link

As this is one of the first search results that comes up on google when looking for the location of stack compose files, here is the location for a "standard" install on linux:

/var/lib/docker/volumes/portainer_data/_data/compose/

thank you 👯
im have error message like this and im create folder 150 in compose directory
image

@Battleman
Copy link

Battleman commented Feb 8, 2023

You will have for example /data/compose/1/docker-compose.yml, /data/compose/2/docker-compose.yml

This is true for the main portainer app. For agents, it's slightly different. When installing app 1337 through the agent (on machine2, stressing this), communicating with the main portainer on machine1 you'll have:

  • Mounted volumes, secrets,... relative to /data/compose/1337 on machine2
  • BUT, the compose stack file is stored on machine1, relative to the location of portainer's own stack compose file. This means if you have the docker-compose for portainer installed at /opt/portainer/docker-compose.yml, the stack file for 1337 will be at /opt/portainer/portainer_data/compose/1337/docker-compose.yml

Sorry for necrobumping this, but I haven't found this info mentioned elsewhere, and as stated above this page comes often when searching for the location of stack files.

Edit:
Apparently this is not exactly correct: My docker-compose file for portainer contains a volume

volumes:
      - ./portainer_data:/data

responsible for this behavior. So while the above is not universal, there's definitely a different treatment for files from the agent compared to files from the main app.

chiptus pushed a commit to chiptus/portainer that referenced this issue Aug 16, 2023
@punkyard
Copy link

punkyard commented Aug 23, 2023

hi, I'm using a bind volume for Portainer data

    volumes:
      - /Users/MyUSerName/MySubFolder/volumes/portainer/data/:/data
      - /var/run/docker.sock:/var/run/docker.sock #this one adds local environment

when deploying a stack the /data/compose/ folder is scanned as a reference folder:
/Users/MyUserName/MySubFolder/portainer/data/
As I'm using docker desktop at the moment to deploy firefly_iii, I need to specify in my stack/compose file:
env_file: ../firefly_iii/.env
which is actually in /Users/MyUserName/MySubFolder/portainer/data/compose/firefly_iii/.env

I've tried to use and different folder, and specify it in the stack
env_file: /Users/MyUserName/MySubFolder/firefly_iii/.env
But it never worked!!
I hope this helps, it took me a while to figure it out ✌️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/question Questions on the platform
Projects
None yet
Development

No branches or pull requests

6 participants