Last active
March 15, 2017 10:04
-
-
Save mikemadisonweb/2443f8fcb1775af3ad076b6a56148f1b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
in docker-compose.yml: | |
nginx: | |
restart: always | |
build: ./nginx/ | |
ports: | |
- "80:80" | |
extra_hosts: | |
# requires `export DOCKERHOST="$(ifconfig en0 inet | grep "inet " | awk -F'[: ]+' '{ print $2 }')"` in ~/.bash_profile | |
- "dockerhost:$DOCKERHOST" | |
in ~/.bash_profile: | |
# see https://github.com/docker/docker/issues/1143 | |
export DOCKERHOST="$(ifconfig en0 inet | grep "inet " | awk -F'[: ]+' '{ print $2 }')" | |
in nginx-conf: | |
location / { | |
proxy_pass http://dockerhost:3000; | |
proxy_set_header host $host; | |
proxy_set_header x-real-ip $remote_addr; | |
proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# bash commands | |
docker-compose exec php bash | |
# Composer (e.g. composer update) | |
docker-compose exec php composer update | |
# Removes stopped service containers with anonymuous volumes | |
docker-compose rm -v | |
# Retrieve an IP Address (here for the nginx container) | |
docker inspect $(docker ps -f name=nginx -q) | grep IPAddress | |
# MySQL commands | |
docker-compose exec db mysql -uroot -p"root" | |
# Check CPU consumption | |
docker stats $(docker inspect -f "{{ .Name }}" $(docker ps -q)) | |
# Delete all containers | |
docker rm $(docker ps -aq) | |
# Delete all images | |
docker rmi $(docker images -q) | |
# Stop all docker containers | |
docker stop $(docker ps -a -q) | |
# Remove all docker volumes | |
docker volume ls -qf dangling=true | xargs -r docker volume rm |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment