This commit is contained in:
@@ -12,30 +12,25 @@
|
||||
docker image history app:v1
|
||||
```
|
||||
|
||||
## Docker镜像批量打包
|
||||
## 拉取镜像命令
|
||||
|
||||
第一种
|
||||
- 普通拉取镜像命令
|
||||
|
||||
```bash
|
||||
docker save $(docker images | grep -v REPOSITORY | awk 'BEGIN{OFS=":";ORS=" "}{print $1,$2}') -o images.tar
|
||||
```
|
||||
```bash
|
||||
docker pull nginx:latest
|
||||
```
|
||||
|
||||
第二种
|
||||
- 拉取 AMD64 镜像命令
|
||||
|
||||
> 将需要统一打包的镜像写在文件内
|
||||
```bash
|
||||
docker pull --platform linux/amd64 nginx:latest
|
||||
```
|
||||
|
||||
```bash
|
||||
cat > images.txt <<EOF
|
||||
nginx:alpine
|
||||
nginx:latest
|
||||
EOF
|
||||
```
|
||||
- 拉取 ARM64 镜像命令
|
||||
|
||||
打包
|
||||
|
||||
```bash
|
||||
docker save -o images.tar.gz $(cat images.txt)
|
||||
```
|
||||
```bash
|
||||
docker pull --platform linux/arm64 nginx:latest
|
||||
```
|
||||
|
||||
## 清理资源命令
|
||||
|
||||
@@ -45,6 +40,12 @@ docker save -o images.tar.gz $(cat images.txt)
|
||||
docker rm $(docker ps -q -f status=exited)
|
||||
```
|
||||
|
||||
- 批量删除所有容器
|
||||
|
||||
```bash
|
||||
docker rm -f $(docker ps -a --format "{{.Names}}")
|
||||
```
|
||||
|
||||
- 移除所有没有使用的镜像
|
||||
|
||||
```bash
|
||||
|
||||
Reference in New Issue
Block a user