Skip to content

Commit

Permalink
vault backup: 2024-06-20 19:15:46
Browse files Browse the repository at this point in the history
Affected files:
content/.obsidian/plugins/recent-files-obsidian/data.json
content/.obsidian/workspace.json
content/docker/Docker CLI Commands.md
content/docker/Docker Container Lifecycle.md
content/docker/cli-commands/docker container prune.md
content/docker/cli-commands/docker logs.md
content/docker/cli-commands/docker ps.md
content/docker/cli-commands/docker stop, kill.md
  • Loading branch information
windsuzu committed Jun 20, 2024
1 parent c72605a commit 2b4d86e
Show file tree
Hide file tree
Showing 8 changed files with 137 additions and 78 deletions.
48 changes: 24 additions & 24 deletions content/.obsidian/plugins/recent-files-obsidian/data.json
Original file line number Diff line number Diff line change
@@ -1,40 +1,48 @@
{
"recentFiles": [
{
"basename": "docker stop, kill",
"path": "docker/cli-commands/docker stop, kill.md"
},
{
"basename": "Docker Container Lifecycle",
"path": "docker/Docker Container Lifecycle.md"
},
{
"basename": "Docker",
"path": "docker/Docker.md"
"basename": "docker container prune",
"path": "docker/cli-commands/docker container prune.md"
},
{
"basename": "docker run, create, start",
"path": "docker/cli-commands/docker run, create, start.md"
"basename": "docker logs",
"path": "docker/cli-commands/docker logs.md"
},
{
"basename": "Docker Image",
"path": "docker/Docker Image.md"
},
{
"basename": "Docker CLI Commands",
"path": "docker/Docker CLI Commands.md"
"basename": "docker ps",
"path": "docker/cli-commands/docker ps.md"
},
{
"basename": "Docker Container",
"path": "docker/Docker Container.md"
"basename": "docker stop, kill",
"path": "docker/cli-commands/docker stop, kill.md"
},
{
"basename": "docker run, create, start",
"path": "docker/cli-commands/docker run, create, start.md"
},
{
"basename": "Docker IT flags",
"path": "docker/Docker IT flags.md"
},
{
"basename": "docker-container-lifecycle",
"path": "attachments/docker-container-lifecycle.png"
"basename": "Docker",
"path": "docker/Docker.md"
},
{
"basename": "Docker Image",
"path": "docker/Docker Image.md"
"basename": "Docker Container",
"path": "docker/Docker Container.md"
},
{
"basename": "docker-container-lifecycle",
"path": "attachments/docker-container-lifecycle.png"
},
{
"basename": "Install Docker on Windows WSL 2",
Expand Down Expand Up @@ -191,14 +199,6 @@
{
"basename": "CSS MOC",
"path": "mocs/CSS MOC.md"
},
{
"basename": "Backend MOC",
"path": "mocs/Backend MOC.md"
},
{
"basename": "PostgreSQL",
"path": "postgresql/PostgreSQL.md"
}
],
"omittedPaths": [],
Expand Down
34 changes: 11 additions & 23 deletions content/.obsidian/workspace.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,6 @@
{
"id": "94dafe9c731fce38",
"type": "leaf",
"state": {
"type": "markdown",
"state": {
"file": "docker/cli-commands/docker stop, kill.md",
"mode": "source",
"source": false
}
}
},
{
"id": "720ac84f203cc18f",
"type": "leaf",
"state": {
"type": "markdown",
"state": {
Expand Down Expand Up @@ -114,7 +102,7 @@
"state": {
"type": "localgraph",
"state": {
"file": "docker/cli-commands/docker stop, kill.md",
"file": "docker/Docker Container Lifecycle.md",
"options": {
"collapse-filter": true,
"search": "",
Expand Down Expand Up @@ -164,7 +152,7 @@
"state": {
"type": "outline",
"state": {
"file": "docker/cli-commands/docker stop, kill.md"
"file": "docker/Docker Container Lifecycle.md"
}
}
},
Expand Down Expand Up @@ -205,7 +193,7 @@
"state": {
"type": "file-properties",
"state": {
"file": "docker/cli-commands/docker stop, kill.md"
"file": "docker/Docker Container Lifecycle.md"
}
}
}
Expand All @@ -222,7 +210,7 @@
"state": {
"type": "outgoing-link",
"state": {
"file": "docker/cli-commands/docker stop, kill.md",
"file": "docker/Docker Container Lifecycle.md",
"linksCollapsed": false,
"unlinkedCollapsed": false
}
Expand All @@ -241,7 +229,7 @@
"state": {
"type": "backlink",
"state": {
"file": "docker/cli-commands/docker stop, kill.md",
"file": "docker/Docker Container Lifecycle.md",
"collapseAll": false,
"extraContext": false,
"sortOrder": "alphabetical",
Expand Down Expand Up @@ -273,16 +261,19 @@
},
"active": "94dafe9c731fce38",
"lastOpenFiles": [
"docker/cli-commands/docker container prune.md",
"docker/Docker Container Lifecycle.md",
"docker/Docker.md",
"docker/cli-commands/docker logs.md",
"docker/Docker Image.md",
"docker/cli-commands/docker ps.md",
"docker/cli-commands/docker stop, kill.md",
"docker/cli-commands/docker run, create, start.md",
"docker/Docker IT flags.md",
"docker/Docker.md",
"docker/Docker CLI Commands.md",
"docker/Docker Container.md",
"docker/Docker IT flags.md",
"attachments/docker-container-lifecycle.png",
"docker/cli-commands",
"docker/Docker Image.md",
"docker/Install Docker on Windows WSL 2.md",
"attachments/docker-image.png",
"attachments/docker-container.png",
Expand Down Expand Up @@ -311,9 +302,6 @@
"browser-event/Event Capturing and Bubbling.md",
"browser-event",
"index.md",
"mocs/JavaScript MOC.md",
"javascript/Pattern Matching (ts-pattern).md",
"javascript/Imperative and Declarative Programming.md",
"attachments/event-capturing-and-bubbling.png",
"attachments/Pasted image 20240524152334.png",
"prettier",
Expand Down
23 changes: 0 additions & 23 deletions content/docker/Docker CLI Commands.md

This file was deleted.

11 changes: 9 additions & 2 deletions content/docker/Docker Container Lifecycle.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
draft: false
date: 2024-06-18 18:24
date: 2024-06-20 18:32
tags:
- docker
---
Expand All @@ -13,13 +13,20 @@ When a [[Docker]] container is created with `docker create`, it can be started u
>[!seealso]
>- [[docker run, create, start]]
When the container is running, you can either stop it using `docker stop`, kill it using `docker kill`, or run additional commands inside the container's environment using `docker exec`, which is a way to interact with the container while it's running.
When the container is running, you can either stop it using `docker stop`, kill it using `docker kill`, or run additional commands inside the container's environment using `docker exec`, which is a way to interact with the container while it's running.

You can use `docker ps` to display information about running containers. You can also use `docker logs` to display the output from the container's `STDOUT` and `STDERR`.

>[!seealso]
>- [[docker stop, kill]]
>- [[docker ps]]
>- [[docker logs]]
Once a container has completed its processes and stopped, you can restart it with `docker start`, as long as it hasn't been removed. If you want to remove the container from your machine, you can use `docker container prune` to remove all non-running containers.

>[!seealso]
>- [[docker container prune]]

> [!info] References
> - [Docker and Kubernetes: The Complete Guide](https://www.udemy.com/course/docker-and-kubernetes-the-complete-guide)
28 changes: 28 additions & 0 deletions content/docker/cli-commands/docker container prune.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
draft: false
date: 2024-06-20 18:20
tags:
- docker
---

The `docker container prune` will get your confirmation and remove all stopped containers from your local machine.

```bash
docker container prune

# WARNING! This will remove all stopped containers.
# Are you sure you want to continue? [y/N] y

# Deleted Containers:
# 610ea68044541a3b4e2bac5ca889b6978e1fa529dd5c96199aeeb11b9b9b5765
# 65ed6cd1dfba08a177fcdead54133071c85280e5a73311c86300e967a4fa9c23
# 3f0e22ece1bf45ddb0ba2e5a02ea61bf2508a31f4f3fadc1987b14b97f500f72
# 01fcc6eb224d745d16e52055e5a643a9bdeea0de75c587a10fbff20c04f2b23b

# Total reclaimed space: 32B
```


> [!info] References
> - [Docker and Kubernetes: The Complete Guide](https://www.udemy.com/course/docker-and-kubernetes-the-complete-guide)
> - [docker container prune | Docker Docs](https://docs.docker.com/reference/cli/docker/container/prune/)
33 changes: 33 additions & 0 deletions content/docker/cli-commands/docker logs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
draft: false
date: 2024-06-20 18:45
tags:
- docker
---

The `docker logs` command allows you to read the output from `STDOUT` and `STDERR` of a a [[docker container|container]] as a batch. You can add a `-f` or `--follow` flag to stream the output from the container in real time.

```bash
docker logs [options] container_id
```

>[!example]
>
>The following example uses `docker logs` to retrieve the output of the container created with `hello-world` [[docker image|image]].
>
>```bash
>docker create hello-world
># 319297ab159e46b41a1cd580e2c02f05e40ca43f76b3fb679e478d7a6ae16c57
>
>docker start 319297ab159e46b41a1cd580e2c02f05e40ca43f76b3fb679e478d7a6ae16c57
># 319297ab159e46b41a1cd580e2c02f05e40ca43f76b3fb679e478d7a6ae16c57
>
>docker logs 319297ab159e46b41a1cd580e2c02f05e40ca43f76b3fb679e478d7a6ae16c57
># Hello from Docker!
># This message shows that your installation appears to be working correctly.
>```

> [!info] References
> - [Docker and Kubernetes: The Complete Guide](https://www.udemy.com/course/docker-and-kubernetes-the-complete-guide)
> - [docker container logs | Docker Docs](https://docs.docker.com/reference/cli/docker/container/logs/)
23 changes: 23 additions & 0 deletions content/docker/cli-commands/docker ps.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
draft: false
date: 2024-06-20 18:05
tags:
- docker
---

The `docker ps` (short for `docker container ls`) command allows you to check the `CONTAINER_ID`, `IMAGE_NAME`, `COMMAND`, `CREATED_TIME`, `STATUS`, `PORTS`, and `NAME` of the running container.

```bash
docker ps [options]
```

>[!example]
>You can add an `-a` or `-all` flag to `docker ps` to show information about all containers you've run before. Without this flag, you will only see the currently running containers.
>
>```bash
>docker ps -a
>```
> [!info] References
> - [Docker and Kubernetes: The Complete Guide](https://www.udemy.com/course/docker-and-kubernetes-the-complete-guide)
> - [docker ps | Docker Docs](https://docs.docker.com/reference/cli/docker/container/ls/)
15 changes: 9 additions & 6 deletions content/docker/cli-commands/docker stop, kill.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
---
draft: false
date: 2024-06-15 19:04
date: 2024-06-20 18:16
tags:
- docker
---

These commands are strongly associated with the [[Docker Container Lifecycle]].

## docker stop
It's recommended to use `docker stop` to stop a [[docker container|container]] first, instead of using `docker kill`. The `docker stop` command sends a `SIGTERM` signal to the container, allowing the container to terminate its processes gracefully and cleanly.

```bash
docker stop container_id
```

If the container doesn't stop with `docker stop` within a specified timeout period, [[Docker]] then sends a `SIGKILL` signal, which is equivalent to `docker kill` command, to the container again to force it to stop.



## docker kill

```bash
docker kill container_id
```


> [!info] References
Expand Down

0 comments on commit 2b4d86e

Please sign in to comment.