zsh/docker: update
This commit is contained in:
parent
24641e264e
commit
f8af762ea3
47
docker.md
47
docker.md
|
@ -1,13 +1,16 @@
|
||||||
---
|
---
|
||||||
title: Docker CLI
|
title: Docker CLI
|
||||||
category: Devops
|
category: Devops
|
||||||
layout: default-ad
|
layout: 2017/sheet
|
||||||
---
|
---
|
||||||
|
|
||||||
Manage images
|
Manage images
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
|
### Managing images
|
||||||
|
|
||||||
Create an `image` from a Dockerfile:
|
Create an `image` from a Dockerfile:
|
||||||
|
{: .-setup}
|
||||||
|
|
||||||
```yml
|
```yml
|
||||||
docker build [options] .
|
docker build [options] .
|
||||||
|
@ -24,7 +27,7 @@ docker run [options] IMAGE
|
||||||
Manage containers
|
Manage containers
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
Create a `container` from an `image`:
|
### `docker create`
|
||||||
|
|
||||||
```yml
|
```yml
|
||||||
docker create [options] IMAGE
|
docker create [options] IMAGE
|
||||||
|
@ -40,13 +43,17 @@ docker create [options] IMAGE
|
||||||
-e, --env NAME=hello # env vars
|
-e, --env NAME=hello # env vars
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### Example
|
||||||
|
|
||||||
```
|
```
|
||||||
$ docker create --name app_redis_1 \
|
$ docker create --name app_redis_1 \
|
||||||
--expose 6379 \
|
--expose 6379 \
|
||||||
redis:3.0.2
|
redis:3.0.2
|
||||||
```
|
```
|
||||||
|
|
||||||
Run in a `container`:
|
Create a `container` from an `image`.
|
||||||
|
|
||||||
|
### `docker exec`
|
||||||
|
|
||||||
```yml
|
```yml
|
||||||
docker exec [options] CONTAINER COMMAND
|
docker exec [options] CONTAINER COMMAND
|
||||||
|
@ -55,12 +62,17 @@ docker exec [options] CONTAINER COMMAND
|
||||||
-t, --tty # interactive
|
-t, --tty # interactive
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### Example
|
||||||
|
|
||||||
```
|
```
|
||||||
$ docker exec app_web_1 tail logs/development.log
|
$ docker exec app_web_1 tail logs/development.log
|
||||||
$ docker exec -t -i app_web_1 rails c
|
$ docker exec -t -i app_web_1 rails c
|
||||||
```
|
```
|
||||||
|
|
||||||
Start/stop a `container`:
|
Run commands in a `container`.
|
||||||
|
|
||||||
|
|
||||||
|
### `docker start`
|
||||||
|
|
||||||
```yml
|
```yml
|
||||||
docker start [options] CONTAINER
|
docker start [options] CONTAINER
|
||||||
|
@ -70,7 +82,10 @@ docker start [options] CONTAINER
|
||||||
docker stop [options] CONTAINER
|
docker stop [options] CONTAINER
|
||||||
```
|
```
|
||||||
|
|
||||||
Manage `container`s:
|
Start/stop a `container`.
|
||||||
|
|
||||||
|
|
||||||
|
### `docker ps`
|
||||||
|
|
||||||
```
|
```
|
||||||
$ docker ps
|
$ docker ps
|
||||||
|
@ -78,27 +93,35 @@ $ docker ps -a
|
||||||
$ docker kill $ID
|
$ docker kill $ID
|
||||||
```
|
```
|
||||||
|
|
||||||
Managing
|
Manage `container`s using ps/kill.
|
||||||
--------
|
|
||||||
|
|
||||||
Manage `image`s:
|
Images
|
||||||
|
------
|
||||||
|
|
||||||
|
### `docker images`
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ docker images
|
$ docker images
|
||||||
REPOSITORY TAG ID
|
REPOSITORY TAG ID
|
||||||
ubuntu 12.10 b750fe78269d
|
ubuntu 12.10 b750fe78269d
|
||||||
me/myapp latest 7b2431a8d968
|
me/myapp latest 7b2431a8d968
|
||||||
|
```
|
||||||
|
|
||||||
|
```sh
|
||||||
$ docker images -a # also show intermediate
|
$ docker images -a # also show intermediate
|
||||||
```
|
```
|
||||||
|
|
||||||
Delete `image`s:
|
Manages `image`s.
|
||||||
|
|
||||||
|
### `docker rmi`
|
||||||
|
|
||||||
```yml
|
```yml
|
||||||
docker rmi b750fe78269d
|
docker rmi b750fe78269d
|
||||||
```
|
```
|
||||||
|
|
||||||
Resources
|
Deletes `image`s.
|
||||||
---------
|
|
||||||
|
|
||||||
* http://www.docker.io/gettingstarted/
|
Also see
|
||||||
|
--------
|
||||||
|
|
||||||
|
* [Getting Started](http://www.docker.io/gettingstarted/) _(docker.io)_
|
||||||
|
|
39
zsh.md
39
zsh.md
|
@ -1,22 +1,33 @@
|
||||||
---
|
---
|
||||||
title: Zsh
|
title: zsh
|
||||||
category: CLI
|
category: CLI
|
||||||
|
layout: 2017/sheet
|
||||||
---
|
---
|
||||||
|
|
||||||
### Stuff
|
### Expressions
|
||||||
|
|
||||||
!! Last command (sudo !!)
|
| Expression | Example | Description
|
||||||
|
| --- | --- | ---
|
||||||
!* Last command's parameters (vim !*)
|
| `!!` | `sudo !!` | Last command (`sudo !!`)
|
||||||
!^ Last command's first parameter
|
| --- | --- | ---
|
||||||
!$ Last command's last parameter
|
| `!*` | `vim !*` | Last command's parameters (`vim !*`)
|
||||||
|
| `!^` | | Last command's first parameter
|
||||||
!?ls<tab> Command and params of last `ls` command (sudo !?mv<tab>)
|
| `!$` | | Last command's last parameter
|
||||||
!?ls?:*<tab> Params of last `ls` command
|
| --- | --- | ---
|
||||||
|
| `!?ls<tab>` | `sudo !?mv<tab>` | Command and params of last `ls` command
|
||||||
*(m0) Last modified today
|
| `!?ls?:*<tab>` | | Params of last `ls` command
|
||||||
*(m-4) Last modified <4 days ago
|
| --- | --- | ---
|
||||||
|
| `*(m0)` | `rm *(m0)` | Last modified today
|
||||||
|
| `*(m-4)` | | Last modified <4 days ago
|
||||||
|
|
||||||
### Change default shell
|
### Change default shell
|
||||||
|
|
||||||
chsh -s `which zsh`
|
```bash
|
||||||
|
chsh -s `which zsh`
|
||||||
|
```
|
||||||
|
|
||||||
|
### Also see
|
||||||
|
|
||||||
|
- [Bash cheatsheet](./bash)
|
||||||
|
|
||||||
|
Zsh is mostly compatible with Bash, so most everything in Bash's cheatsheet also applies.
|
||||||
|
|
Loading…
Reference in New Issue