Cannot start service prisma-db: container already exists

prisma

#1

Hi guys! After system reboot prisma local start usually fails with following error:

Booting local development cluster !
▸    Recreating local_prisma-database_1 ...
Starting prisma-db ... error
▸
▸    ERROR: for prisma-db  Cannot start service prisma-db: container
Recreating local_prisma-database_1 ... done
▸
▸    ERROR: for prisma-db  Cannot start service prisma-db: container
▸    "bbae92345af4b60f188cf39d88ee61ae22bbd3ef77cd5cd2a861058286670a1a": already exists
▸    Encountered errors while bringing up the project.

docker rm bbae92345af4 solves the problem, but is this right solution? Why I have to remove mysql container before starting local cluster?


#2

Did you stop your old cluster first by running prisma local stop?


#3

No, system was after reboot and there was no running docker containers.


#4

Sounds strange. Not sure why this is happening. Will docker automatically start currently running containers after a reboot?


#5

No, docker ps -a shows following information after reboot:

CONTAINER ID        IMAGE                      COMMAND                  CREATED              STATUS                      PORTS                    NAMES
b665fb9d12de        mysql:5.7                  "docker-entrypoint.s…"   7 days ago           Exited (255) 3 days ago     0.0.0.0:3307->3306/tcp   prisma-db

And prisma local start exits with error:

▸    ERROR: for prisma-db  Cannot start service prisma-db: container
▸    "b665fb9d12de1bd718eaa79875581e92daa41b4df86f1a80dc845cc53019d1a9": already exists

#6

@meep Yap, this is due to the restart policy defined in the docker-compose.yml of Prisma. This leads to the scenario where the MySQL container starts after booting the machine.

@xcrzx You could perform a docker kill $(docker ps -q) which kills all your local containers and try prisma local start afterwards.

@nikolas, @nilan What do you think? Should the restart policy be changed in the docker-compose.yml that ships with Prisma? restart: on-failure might be a saner default.


#7

@andre, sounds like a good idea! Can you please provide a feature request? :slight_smile:


#8

Thanks for this suggestion Andre! I have merged your pull request: https://github.com/graphcool/prisma/pull/2130/


#9

@sorenbs You’re welcome :slightly_smiling_face: Awesome. Thanks :slight_smile: