Skip to content

Instantly share code, notes, and snippets.

@usagizmo
Last active August 31, 2018 14:32
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 usagizmo/03dd9c14ca13a917306ea44fc2874590 to your computer and use it in GitHub Desktop.
Save usagizmo/03dd9c14ca13a917306ea44fc2874590 to your computer and use it in GitHub Desktop.
Execute docker bash and save database sample
{
"scripts": {
"save": "did=`docker ps | awk '$2==\"mysql:5.7\" { print $1 }'` && docker exec -it $did sh -c 'mysqldump wordpress -u wordpress -pwordpress 2> /dev/null' > ./docker-entrypoint-initdb.d/install_wordpress.sql",
"bash": "did=`docker ps | awk '$2==\"wordpress:latest\" { print $1 }'` && docker exec -it $did bash"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment