Ярлыки

.htaccess (4) тестирование (8) шаблоны проектирования (3) css (5) Debian (6) docker (2) Doctrine2 (6) Git (6) html (4) java (6) javascript (13) jquery (11) LFS (3) linux (23) mac os (4) mod_rewrite (2) MSSQL (4) MySQL (18) ORM Doctrine (17) patterns (3) PDO (3) perl (7) PHP (64) PHPUnit (8) Python (15) SEO (2) Silex (1) SimpleXML (1) SQL (14) ssh (4) Ubuntu (24) Yii1 (1) Zend Framework (19) ZendFramework2 (8)

пятница, 13 мая 2016 г.

Docker. Commands.

# build container
$ docker build -t mysite .

# run container
$ docker run -p 8080:80 -d -v /Users/dan/site:/var/www/site mysite
# -v map host directory to container

# delete all containers
$ docker rm $(docker ps -a -q)

# delete all images
$ docker rmi $(docker images -q)

# stop all containers
$ docker stop $(docker ps -a -q)

# run container in interactive mode with tty
$ docker run -i -t ubuntu /bin/bash

# debug container
$ docker run --name instance.project.com project.com
$ docker exec -it instance.project.com /bin/bash

Git. List files with git diff-tree.

git diff-tree -r 393751f286f3153e8c2bee8adfd27b533788425f d0049f627ab57040c0c63c71472c199a417cea6b | cut -d$'\t' -f2

# cut -d$'\t' -f2  - cut output string by tabs and get second segment

# list files in last commit
git log --oneline | head -n1 | cut -d' ' -f1 | xargs git diff-tree --no-commit-id --name-only -r
# cut -d' ' -f1    - cut output string by delimiter in -d param and get segment by number in -f param
# head -n1         - get first string from the top of the output
# xargs            - pass previous output as args to the command
# or
git rev-parse HEAD | xargs git diff-tree --no-commit-id --name-only -r

# list all but not deleted
git diff --name-only --diff-filter=ACMRTUXB HEAD^..HEAD