after migration, message when try to open stack: could not get the contents of the file 'docker-compose.yml' #9297
Replies: 5 comments 2 replies
-
it seems that some folder locations are hard copied in the export file "export-1686814745.json" "com.docker.compose.project.config_files" Doesn't feel right. The new data and therefore also compose folder are indeed in the new situation in a new folder. I have tried to change it to the new folder structure, and restored again with the new data but without luck. same issue. Any tricks to change the path to the /data/compose folder? |
Beta Was this translation helpful? Give feedback.
-
I found a workaround... Connect the old folder structure to a new folder with the compose files. The original folder structure from the my post above from the export file was '/share/CACHEDEV1_DATA/.qpkg/Portainer/data/compose'. First i copied the data/compose folder to a separate folder outside data/, in my case ' /share/docker-volumes/Portainer/oldcompose' then i created a new volume in my docker-compose file for portainer, like:
Done! Hope it helps anyone, but it can also be a bug. |
Beta Was this translation helpful? Give feedback.
-
This is one of the drawbacks of using bind mounts, and is why we recommend using a named volume (
Where is this export file coming from? We don't generate one when doing a Portainer backup. |
Beta Was this translation helpful? Give feedback.
-
I had the same error but the issue was that Portainer was looking for the docker-compose.yml file in the v1 subfolder, which did not exist. I believe the versioning was a new addition. I simply created a folder called |
Beta Was this translation helpful? Give feedback.
-
Was also having probles with this one. In our case we moved Portainer from Windows to Linux and there was 2 issues:
That export file mentioned in other comments is just a export and it seems not to be used when restoring db. @jamescarppe If I understood correctly that export is done here: func (c *DbConnection) ExportJSON(databasePath string, metadata bool) ([]byte, error) {
log.Debug().Str("databasePath", databasePath).Msg("exportJson") Go code to modify the ProjectPath in stacks bucket (or any string that has specified chars). It uses portainer.db file directly, which you can get by creating a backup from UI. It expects portainer.db to be in C:\tmp folder. package main
import (
"bytes"
"fmt"
"log"
"os"
bolt "go.etcd.io/bbolt"
)
func main() {
db, err := bolt.Open("c:/tmp/portainer.db", 0600, nil)
if err != nil {
log.Fatal(err)
}
defer db.Close()
err = db.Update(func(tx *bolt.Tx) error {
bucket := tx.Bucket([]byte("stacks"))
if bucket == nil {
return fmt.Errorf("bucket stack not found")
}
c := bucket.Cursor()
for k, v := c.First(); k != nil; k, v = c.Next() {
fmt.Printf("key=%s, value=%s\n", k, v)
if bytes.Contains(v, []byte(`C:\\data`)) {
newValue := bytes.Replace(v, []byte(`C:\\data`), []byte(`/data`), -1)
err := bucket.Put(k, newValue)
if err != nil {
return err
}
}
}
return nil
})
if err != nil {
fmt.Printf("Could not update the database: %v\n", err)
os.Exit(1)
}
} |
Beta Was this translation helpful? Give feedback.
-
Migrate from QNAP Portainer app installation to self installed docker installation.
The Qnap app was not ideally installed (and updated) and therefore i decided to install Portainer by myself (by using docker-compose, which work flawlessly accept the stacks.
I used the backup and restore functionality for migration.
I see all stacks in the list.
But when i try to open an stack, i'm getting the message could not get the contents of the file 'docker-compose.yml'
I'm not able to see the content (docker-compose.yml) of the strack and also not able to edit it. Containers are visible though which are related to the stack.
When i look at the data folder, all compose folders are perfectly migrated, so the content is there.
What i'm i missing? (it's not folder permissions)
Any help very much appreciated, thank you.
Beta Was this translation helpful? Give feedback.
All reactions