Skip to content

Instantly share code, notes, and snippets.

@eukras
Last active March 28, 2017 14:45
Show Gist options
  • Save eukras/c8818a61f9c4b9197273 to your computer and use it in GitHub Desktop.
Save eukras/c8818a61f9c4b9197273 to your computer and use it in GitHub Desktop.
#!/bin/bash
# For greatest convenience
alias dc='docker-compose'
# Clean up unused containers and images
alias dclean='docker rm $(docker ps -qf "status=exited")'
alias dclean_images='docker rmi $(docker images -qf "dangling=true")'
# Assume dockerized $nginx and $mysql containers...
# Bash console in web server
alias mysh='docker exec -it $nginx bash'
# Run PhpUnit in web server; this does not take arguments after the alias.
alias myphpunit='docker exec -it $nginx bash -c "phpunit -v -c /var/app/tests --testsuite Suite"'
# MySQL console in DB Server;
# mymy $database -e "SHOW TABLES;"
alias mymy='docker exec -it $mysql mysql'
# Pipe local files into mysql on DB server (note absence of -t):
# mymypipe < setup.sql
# mymypipe $database < dump.sql
alias mymypipe='docker exec -i $mysql mysql'
# Tail logfile on web server
# myngtail
alias myngtail='docker exec -it $nginx tail -f /var/log/nginx/error.log'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment