til/Development/docker.md

45 lines
1.2 KiB
Markdown
Raw Normal View History

2020-03-21 09:24:35 +00:00
# Docker
Assume you use Archlinux.
Read [Docker](https://wiki.archlinux.org/index.php/Docker).
2020-04-30 16:32:50 +00:00
Read [LinuxServer.io/Docs](https://docs.linuxserver.io/).
2020-03-31 07:46:58 +00:00
Start/enable service:
```sh
systemctl start docker.service
systemctl enable docker.service
```
Add your user to `docker` group:
```sh
sudo usermod -aG docker $USER
```
2020-03-21 09:24:35 +00:00
Delete all images, containers, volumes, and networks that are not associated with a container (dangling):
```sh
docker system prune
```
2020-03-31 09:26:22 +00:00
Read [docker run](https://docs.docker.com/engine/reference/commandline/run/).
| option | example | explain |
| -------- | --------------- | ----------------------------------------- |
| `-i` | | Keep STDIN open even if not attached |
| `--name` | | |
| `-p` | `-p 8080:80` | Publish container port : host port |
| `--rm` | | |
| `-t` | | Allocate a pseudo-TTY |
| `-v` | `-v ~/abc:/abc` | Bind host directory : container directory |
Run `ubuntu` image:
```sh
docker run --rm -it ubuntu
```