update README.md

* remove trailing spaces
* remove unnecessary backtick
* update backtick command substitution to dollar/parens form
This commit is contained in:
Karl Herrick 2016-04-25 16:55:38 -04:00
parent 4c5d475b4e
commit 362a68b96b

View file

@ -469,25 +469,25 @@ Sources:
```
alias dl='docker ps -l -q'
docker run ubuntu echo hello world
docker commit `dl` helloworld
docker commit $(dl) helloworld
```
### Commit with command (needs Dockerfile)
```
docker commit -run='{"Cmd":["postgres", "-too -many -opts"]}' `dl` postgres
docker commit -run='{"Cmd":["postgres", "-too -many -opts"]}' $(dl) postgres
```
### Get IP address
```
docker inspect `dl` | grep IPAddress | cut -d '"' -f 4
docker inspect $(dl) | grep IPAddress | cut -d '"' -f 4
```
or install [jq](https://stedolan.github.io/jq/):
```
docker inspect `dl` | jq -r '.[0].NetworkSettings.IPAddress'
docker inspect $(dl) | jq -r '.[0].NetworkSettings.IPAddress'
```
or using a [go template](https://docs.docker.com/reference/commandline/inspect)
@ -505,7 +505,7 @@ docker inspect -f '{{range $p, $conf := .NetworkSettings.Ports}} {{$p}} -> {{(in
### Find containers by regular expression
```
for i in $(docker ps -a | grep "REGEXP_PATTERN" | cut -f1 -d" "); do echo $i; done`
for i in $(docker ps -a | grep "REGEXP_PATTERN" | cut -f1 -d" "); do echo $i; done
```
### Get Environment Settings
@ -529,7 +529,7 @@ docker ps -a | grep 'weeks ago' | awk '{print $1}' | xargs docker rm
### Delete stopped containers
```
docker rm -v `docker ps -a -q -f status=exited`
docker rm -v $(docker ps -a -q -f status=exited)
```
### Delete dangling images