2021-05-03 00:08:07 +02:00
|
|
|
# Docker
|
|
|
|
|
|
|
|
## Handling Builds
|
2021-06-20 23:15:48 +02:00
|
|
|
### Building a Docker image
|
|
|
|
```bash
|
|
|
|
sudo docker build -t tag/name .
|
|
|
|
```
|
|
|
|
> **_NOTE:_** The `-t`-tag stands for Tag followed by the Tag-Name and the `.` is the location of the Dockerfile.
|
2021-05-03 00:08:07 +02:00
|
|
|
|
|
|
|
## Handling Images
|
2021-06-20 23:15:48 +02:00
|
|
|
### List all images
|
|
|
|
```bash
|
|
|
|
sudo docker images
|
|
|
|
```
|
|
|
|
|
|
|
|
### Delete all unused Images
|
|
|
|
```bash
|
|
|
|
sudo docker image prune -a
|
|
|
|
```
|
2021-05-03 00:08:07 +02:00
|
|
|
|
|
|
|
## Handlicng Containers
|
2021-06-20 23:15:48 +02:00
|
|
|
### List all running containers
|
|
|
|
```bash
|
|
|
|
sudo docker ps
|
|
|
|
```
|
|
|
|
|
|
|
|
### List all containers
|
|
|
|
```
|
|
|
|
sudo docker ps -a
|
|
|
|
```
|
|
|
|
|
|
|
|
### Delete a running container
|
|
|
|
```
|
|
|
|
sudo docker rm -f <containername>
|
|
|
|
```
|
|
|
|
> **_NOTE:_** The `-f`-tag stands for force-command
|
|
|
|
|
|
|
|
### List all Containers with `Exited` Code
|
|
|
|
```bash
|
|
|
|
sudo docker ps -q -f status=exited
|
|
|
|
```
|
2021-05-03 00:08:07 +02:00
|
|
|
|
2021-06-20 23:15:48 +02:00
|
|
|
### Delete all containers with `Exited` Code
|
|
|
|
```bash
|
|
|
|
sudo docker rm $(sudo docker ps -q -f status=exited)
|
|
|
|
```
|
2021-05-03 00:08:07 +02:00
|
|
|
## Handling private registry
|