Update docker.md
parent
9528a350d6
commit
36c6ec08d4
|
@ -17,25 +17,25 @@ Add your user to `docker` group:
|
||||||
sudo usermod -aG docker $USER
|
sudo usermod -aG docker $USER
|
||||||
```
|
```
|
||||||
|
|
||||||
Delete all images, containers, volumes, and networks that are not associated with a container (dangling):
|
## Command-line
|
||||||
|
|
||||||
|
Remove unused data:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
docker system prune
|
docker system prune
|
||||||
|
|
||||||
|
docker system prune -a
|
||||||
```
|
```
|
||||||
|
|
||||||
Read [docker run](https://docs.docker.com/engine/reference/commandline/run/).
|
Docker run options:
|
||||||
|
|
||||||
| option | example | explain |
|
| option | example | explain |
|
||||||
| -------- | --------------- | ----------------------------------------- |
|
| --------------------- | ------------------------ | --------------------------------------- |
|
||||||
| `-i` | | Keep STDIN open even if not attached |
|
| `--detach`, `-d` | | Run container in background |
|
||||||
| `--name` | | |
|
| `--env`, `-e` | `-e PLATFORM=linux` | Set environment variables |
|
||||||
| `-p` | `-p 8080:80` | Publish container port : host port |
|
| `--interactive`, `-i` | | Keep STDIN open |
|
||||||
| `--rm` | | |
|
| `--name` | | |
|
||||||
| `-t` | | Allocate a pseudo-TTY |
|
| `--publish`, `-p` | `-p 8080:80` | Publish container port:host port |
|
||||||
| `-v` | `-v ~/abc:/abc` | Bind host directory : container directory |
|
| `--rm` | | Remove container when exit |
|
||||||
|
| `--tty`, `-t` | | Allocate a pseudo-TTY |
|
||||||
Example run `ubuntu` image:
|
| `--volume`, `-v` | `-v "$(pwd)"/data:/data` | Bind host directory:container directory |
|
||||||
|
|
||||||
```sh
|
|
||||||
docker run --rm -it ubuntu
|
|
||||||
```
|
|
||||||
|
|
Loading…
Reference in New Issue