Skip to content

Instantly share code, notes, and snippets.

@colorful-tones
Last active October 12, 2018 15:34
Show Gist options
  • Save colorful-tones/9c80beefd25ec5dbe6ad0b2b4c0b7725 to your computer and use it in GitHub Desktop.
Save colorful-tones/9c80beefd25ec5dbe6ad0b2b4c0b7725 to your computer and use it in GitHub Desktop.
docker
#########################################
# Docker #
#########################################
alias dc="docker-compose"
# Interact with WP-CLI in Docker container
alias dockwp="docker-compose exec --user www-data phpfpm wp"
# SSH in to Docker container
alias dockroot="docker-compose exec --user root phpfpm bash"
alias dockbash='docker-compose exec --user www-data phpfpm bash'

View running processes

docker ps

View all processes

docker ps -a

List (running) containers

docker container ls

List all containers

docker container ls -a

Stop ALL running containers

docker stop $(docker ps -aq)

Remove ALL running containers

docker rm $(docker ps -aq)

====================================

Not Docker related, but help see what processes (if any) are running on port 3306

lsof -i:3306
#########################################
# Docker #
#########################################
# Stop all docker containers
dockerstop() {
docker stop $(docker ps -aq) && docker rm $(docker ps -aq);
}
# Stop all docker containers anywhere and start from the folder
dockerstart() {
dockerstop; dc up -d;
}
# Create a new project with WP Local Docker
wp-docker() {
git clone git@github.com:10up/wp-local-docker.git "$1";
cd $1;
docker-compose up -d;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment