mirror of
https://github.com/wsargent/docker-cheat-sheet.git
synced 2025-09-22 05:40:50 +02:00
update README.md
* remove trailing spaces * remove unnecessary backtick * update backtick command substitution to dollar/parens form
This commit is contained in:
parent
4c5d475b4e
commit
362a68b96b
1 changed files with 15 additions and 15 deletions
12
README.md
12
README.md
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue