Issue with Docker -- Mount Location

This is a conversation between Hatch, one of our community members (Hatch) and appsmith-support regarding an issue with docker errors and mount location while installing the appsmith community edition.

Issue:

Installed via docker on a server this weekend. Had 1 app on (the demo maybe) and 1 I just started today. Went for lunch, came back and was logged out. Went to log in but it said my account didn’t exist so I created an account (I only use 1 email for this kind of stuff) and the apps are gone. It does say it is a new version as of an hour ago. So, did it update and blow away my apps? How do I keep this from happening?

I do have this in my docker-compose.yml:

 - ./stacks:/containers/appsmith/persistent

and the docker-compose.yml is in the /containers/appsmith folder. I noticed docker added a /stacks folder in /containers/appsmith but it (and my “persistent” folder) are empty.

I didn’t get an error it just asked me to create an account… so I did. I’m not worried about what is gone, but would like to know how I can setup docker so it doesn’t happen again. Here’s my entire yml:

version: "3"

services:
  appsmith:
    image: index.docker.io/appsmith/appsmith-ce
    container_name: appsmith
    ports:
      - "8080:80"
      - "8443:443"
      - "9001:9001"
    volumes:
      - ./stacks:/containers/appsmith/persistent
    labels:
      com.centurylinklabs.watchtower.enable: "true"
    restart: unless-stopped

  auto_update:
    image: containrrr/watchtower:latest-dev
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    # Update check interval in seconds.
    command: --schedule "0 0 * ? * *" --label-enable --cleanup
    restart: unless-stopped

FYI this is on a fresh ubuntu install with only docker and docker-compose installed.

Solution from @arpit_appsmith :

I see that you mounted ./stacks folder to /containers/appsmith/persistent . In this case, the 1st path is the one on your host machine while the 2nd path is actually the one inside the container. Hence, in this case, you ideally want to do the following:

volumes:
      - ./containers/appsmith/persistent:/appsmith-stacks

My hunch is that inside the container, all the persistent data paths (MongoDB especially) look at /appsmith-stacks for data. This is why on container restart, the data didn’t get restored and Appsmith assumed it was a new instance.