Data does not persist in Docker after service restart
jaredcnance opened this issue · 0 comments
jaredcnance commented
I'm running this in swarm mode and if I scale the web app down to 0 and back up, the database tables get dropped and re-created. Note that the database service is running the entire time.
> docker service scale doctor_web=0
> docker service scale doctor_web=1
And the logs:
> docker logs 1ce0cd97d887
2017-02-10T21:53:05.958280710Z doctor already exists
2017-02-10T21:53:07.614294467Z -- enable_extension("plpgsql")
2017-02-10T21:53:07.636733858Z SQL (1.0ms) CREATE EXTENSION IF NOT EXISTS "plpgsql"
2017-02-10T21:53:07.646278382Z -> 0.0324s
2017-02-10T21:53:07.646299682Z -- create_table("brands", {:force=>:cascade})
2017-02-10T21:53:07.658275737Z (9.7ms) DROP TABLE "brands" CASCADE
2017-02-10T21:53:07.747764499Z (80.9ms) CREATE TABLE "brands" ("id" serial primary key, "title" character varying, "logo_url" character varying, "tagline" character varying, "home_link" character varying, "github_l
...
2017-02-10T21:53:07.747800900Z -> 0.1014s
2017-02-10T21:53:07.747804700Z -- create_table("categories", {:force=>:cascade})
2017-02-10T21:53:07.756653014Z (7.3ms) DROP TABLE "categories" CASCADE
2017-02-10T21:53:07.824641597Z (67.8ms) CREATE TABLE "categories" ("id" serial primary key, "title" character varying, "desc" text, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
2017-02-10T21:53:07.824668797Z -> 0.0768s
...