Starting stopped docker container
Today we faced with a scenario where we started Kong API gateway and tried to access previously created APIs and keys. They were gone, they do not exist. Thats where we got panicked.
How we solved it?
First get stopped docker containers
docker ps -a
This will list all stopped containers. Then starting the previously used container we want. (postgresql and kong)
docker container start
Best practice for long running docker containers
As we normally use
docker run image-name , this may get into problems when its used in a production server. When node is restarted we will have to manually start these containers.
docker run -d --restart unless-stopped redis
This command will automatically start any stopped docker containers crashed during node restart. There are more valueble commands available here in official document.
Also its very important to add docker service to start in bootup.
systemctl enable docker
In this very short guide, I explained an issue we faced. Hope this will help someone to overcome this simple docker based issue.