Files
Obsidian-Main/-21.01. Linux/Docker.md

42 lines
773 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 安裝
根據[# Install Docker Engine on Ubuntu](https://docs.docker.com/engine/install/ubuntu/)來安裝Docker engine。
# 指令
## 列出可用的版本
```bash
# List the available versions:
apt-cache madison docker-ce | awk '{ print $3 }'
5:24.0.0-1~debian.11~bullseye
5:23.0.6-1~debian.11~bullseye
...
```
## 列出 container
`docker ps`會列出執行中的container但是停止的不會
```bash
sudo docker ps
```
如果也要列出已停止的container
```bash
sudo docker ps -a
```
## 刪除 container
Container必須是停止狀態才可以刪除
```bash
sudo docker rm <CONTAINER_ID>
```
## 進入 container 執行 bash
```bash
docker run -i -t <CONTAINER_NAME> /bin/bash
```
## 列出 image
```bash
sudo docker image ls
or
sudo docker images
```