Skip to content

Instantly share code, notes, and snippets.

@cristianounix
Created June 4, 2018 17:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cristianounix/7984978b3d00cafa0b926c083ee739a2 to your computer and use it in GitHub Desktop.
Save cristianounix/7984978b3d00cafa0b926c083ee739a2 to your computer and use it in GitHub Desktop.
Restore database in your container (named database)
#!/bin/bash
if [ -s "$1" ]
then
if [ "$(docker inspect -f {{.State.Running}} database)" != "true" ]
then
echo "Container MySql is not running"
exit 1
fi
else
echo "Syntax: $0 <filename>"
exit 1
fi
cat $1 | docker exec -i database /usr/bin/mysql -uroot -proot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment