colorful-tones
9/11/2018 - 7:10 PM

docker

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;
}