Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Undo docker-compose down

After doing

docker-compose up

and adding lots of stuff to the database etc, I stupidly did a

docker-compose down

to stop the dockers from running. Just found out it actually removes it all.

Is there a way to recover from this and get back the data containers?

FYI This is the config of the datastore in docker-compose.yml:

services:
  jira_datastore:
    image: busybox
    volumes:
      - /data
    entrypoint: echo "PSQL Data"
like image 932
rept Avatar asked Oct 17 '22 13:10

rept


2 Answers

I was able to recover the data, so it indeed is possible, in some cases to retrieve the data.

As mentioned in the question, I had a datastore which points to /data

By doing compose-up again and after this moving the data from the old to the new volume I got everything back!

like image 82
rept Avatar answered Oct 21 '22 01:10

rept


This is not possible :-(. Next time do docker-compose stop to stop but not remove the containers. You could also save the data in a map shared on your host computer to make the data persistent, for more info on this: https://docs.docker.com/engine/tutorials/dockervolumes/

like image 28
Frenus Avatar answered Oct 21 '22 03:10

Frenus