@@ -34,31 +34,47 @@ start Memgraph again.
34
34
35
35
## Why is data lost when Memgraph is restarted?
36
36
37
- <Tabs items = { [' Docker 🐳' , ' Linux' ]} >
38
- <Tab >
39
- Docker containers don’t persist data by default (all changes are lost when the
40
- container is stopped). You need to use local volumes to store the data
41
- permanently which is why Memgraph is started with the ` -v ` flags:
42
-
43
- ``` console
44
- docker run -p 7687:7687 -v mg_lib:/var/lib/memgraph memgraph/memgraph
45
- ```
46
-
47
- More information on Docker Volumes can be found
48
- [ here] ( https://docs.docker.com/storage/volumes/ ) .
49
- </Tab >
50
- <Tab >
51
-
52
- Make sure that Memgraph is searching for the snapshot files in the right
53
- directory. The Memgraph configuration is available in
54
- ` /etc/memgraph/memgraph.conf ` and you can specify the directory with the
55
- ` --data-directory ` flag. If the configuration file is altered, Memgraph needs to
56
- be restarted. The default directory is ` /var/lib/memgraph ` . To learn about all
57
- the configuration options, check out the [ reference
58
- guide] ( /configuration/configuration-settings ) .
59
-
60
- </Tab >
61
- </Tabs >
37
+ When you stop a Docker container, the data and state within that container are
38
+ preserved until the container is explicitly removed. This means that any data or
39
+ changes you've made within the container are retained and can be accessed again
40
+ when the container is restarted.
41
+
42
+ To access this data, you need to ensure you're starting the same container
43
+ instance that you used previously. Here's how you can do that:
44
+
45
+ ### Starting a Named Container
46
+
47
+ If you had named your Memgraph container as "memgraph", for instance, you can
48
+ easily restart it using the following command:
49
+
50
+ ```
51
+ docker start memgraph
52
+ ```
53
+
54
+ This command will bring the named container back to life, retaining all the data
55
+ and changes you had made in it.
56
+
57
+ ### Starting an Unnamed Container
58
+
59
+ If you didn't assign a specific name to your container when you created it,
60
+ Docker would have given it a random name. To find and restart the correct
61
+ container list all the containers on your system using the following command:
62
+
63
+ ```
64
+ docker ps -a
65
+ ```
66
+
67
+ From the list, identify the container you want to restart. Note down the
68
+ container ID associated with it and use it to restart the container:
69
+
70
+ ```
71
+ docker start [CONTAINER_ID]
72
+ ```
73
+
74
+ Replace ` [CONTAINER_ID] ` with the actual ID you noted down. Once executed, your
75
+ container will be up and running again, with all its data intact.
76
+
77
+ ---
62
78
63
79
<Callout type = " info" >
64
80
If you weren't able to find the error, please submit it through a <a href = " https://support.memgraph.com"
0 commit comments