add some posts
This commit is contained in:
30
文章/技术类/docker的容器和镜像的删除操作.md
Normal file
30
文章/技术类/docker的容器和镜像的删除操作.md
Normal file
@@ -0,0 +1,30 @@
|
||||
# Docker容器和镜像的删除操作
|
||||
## 容器和镜像的关系
|
||||
简单来说,镜像是文件,容器是进程。
|
||||
容器是基于镜像创建的,即容器中的进程依赖于镜像中的文件。
|
||||
docker利用容器来运行应用:docker容器是由docker镜像创建的运行实例。
|
||||

|
||||
### 删除镜像的操作步骤
|
||||
#### 一、停止正在运行的镜像创建的容器
|
||||
查看正在运行的容器
|
||||
```shell
|
||||
docker ps
|
||||
```
|
||||
停止对应容器
|
||||
```shell
|
||||
docker stop xxx
|
||||
```
|
||||
xxx 是 docker ps 命令出来的容器 CONTAINER ID 的前三位
|
||||
删除对应的容器
|
||||
```shell
|
||||
docker rm xxx
|
||||
```
|
||||
查看镜像
|
||||
```shell
|
||||
docker images
|
||||
```
|
||||
同理,yyy 是 docker images 命令出来的镜像 IMAGE ID 的前三位
|
||||
删除对应的镜像
|
||||
```shell
|
||||
docker rmi yyy
|
||||
```
|
166
文章/技术类/在ARM架构的Ubuntu中使用Docker Compose部署MTPhotos.md
Normal file
166
文章/技术类/在ARM架构的Ubuntu中使用Docker Compose部署MTPhotos.md
Normal file
@@ -0,0 +1,166 @@
|
||||
# 在ARM架构的Ubuntu中使用Docker Compose部署MTPhotos
|
||||
## 前言
|
||||
之前,我总是使用1panel面板的Docker进行图形化的操作,直到有一天,我遇到了一个需要三个镜像配合的项目——MTPhotos
|
||||
为什么会使用mtphotos呢,我以前都是使用老电脑装飞牛OS当作NAS使用,但是飞牛OS哪哪都挺好,就是不支持vivo的动态图片,相册里的动态图片是一张jpg一段MP4,看得我脑阔痛;而且用X86的核显老电脑安装飞牛OS,视频转码压根跑不动,如此一来,偌大个飞牛就只用来当云相册用有点心疼电费,我就把目光投向了角落的Nanopi-R5S
|
||||
好在[友善官方](https://wiki.friendlyelec.com/wiki/index.php/NanoPi_R5S/zh "友善官方R5S中文文档")一直在更新R5S的各种固件,有OpenWRT有Ubuntu,有Debian,甚至还有Proxmox的固件,我就准备用Ubuntu装个MTPhotos来试试
|
||||
## 准备工作
|
||||
### 将R5S刷入ubuntu-noble-core固件
|
||||
线刷方便得鸭皮,没有 USBA-A 的线材也可以使用卡刷,具体看上方友善官方文档
|
||||
### 装个m.2硬盘进去当docker的镜像盘
|
||||
mtphotos有三个镜像文件,需要七八个G
|
||||
### 安装个[Mobaxtrem汉化版](https://github.com/RipplePiam/MobaXterm-Chinese-Simplified "Mobaxtrem汉化版GitHub仓库")方便文件传输和SSH连接
|
||||
SSH用户是 pi 密码也是
|
||||
## 正式开始部署
|
||||
### 初始化Ubuntu
|
||||
首先当然是Linux初始化套路
|
||||
登录切root用户(懒得加sudo),密码是 pi
|
||||
```shell
|
||||
sudo -i
|
||||
```
|
||||
#### 改时区
|
||||
```shell
|
||||
timedatectl set-timezone Asia/Shanghai
|
||||
```
|
||||
#### 换源
|
||||
Ubuntu 24.04 换源方式有变
|
||||
```shell
|
||||
vim /etc/apt/sources.list.d/ubuntu.sources
|
||||
```
|
||||
用 # 注释掉之前的所有内容,添加如下内容
|
||||
```shell
|
||||
Types: deb
|
||||
URIs: http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/
|
||||
Suites: noble noble-updates noble-security
|
||||
Components: main restricted universe multiverse
|
||||
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
|
||||
```
|
||||
X86架构不需要添加 URIs 条目后的 -ports
|
||||
#### 更新
|
||||
```shell
|
||||
apt update && apt upgrade -y
|
||||
```
|
||||
### 挂载m.2硬盘
|
||||
安装 curl 和 fdisk
|
||||
```shell
|
||||
apt install curl fdisk -y
|
||||
```
|
||||
查看当前m.2硬盘路径
|
||||
```shell
|
||||
fdisk -l
|
||||
```
|
||||
格式化硬盘
|
||||
```shell
|
||||
mkfs.ext4 /dev/nvme0n1
|
||||
```
|
||||
/dev/nvm10n1 是上一步查看到的对应的m.2硬盘路径
|
||||
|
||||
获取硬盘UUID
|
||||
```shell
|
||||
blkid /dev/nvme0n1
|
||||
```
|
||||
创建挂载文件夹
|
||||
```shell
|
||||
mkdir /nvme
|
||||
```
|
||||
编辑自动挂载文件
|
||||
```shell
|
||||
vim /etc/fstab
|
||||
```
|
||||
格式如下
|
||||
```shell
|
||||
UUID=xxxx /nvme ext4 defaults 0 0
|
||||
```
|
||||
xxxx 为 blkid /dev/nvme0n1 命令获取的 UUID="xxxx" 的内容
|
||||
|
||||
重启
|
||||
```shell
|
||||
reboot
|
||||
```
|
||||
### 安装并启动Docker和Docker compose
|
||||
更新包管理工具
|
||||
```shell
|
||||
apt-get update
|
||||
```
|
||||
使用官方一键安装脚本配合阿里云镜像一键安装
|
||||
```shell
|
||||
curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
|
||||
```
|
||||
启动并查看运行状态
|
||||
```shell
|
||||
service docker start
|
||||
docker version
|
||||
docker compose version
|
||||
systemctl status docker
|
||||
```
|
||||
### 配置Docker镜像加速和镜像存放路径
|
||||
```shell
|
||||
vim /etc/docker/daemon.json
|
||||
```
|
||||
按 I 进入编辑模式,配置如下
|
||||
```shell
|
||||
{
|
||||
"registry-mirrors": ["https://docker.xuanyuan.me","https://docker.1panel.live"],
|
||||
"data-root": "/nvme/docker"
|
||||
}
|
||||
```
|
||||
按 Esc 退出编辑模式,输入 :wq 保存并退出
|
||||
重载daemon.json文件
|
||||
```shell
|
||||
systemctl daemon-reload
|
||||
systemctl restart docker
|
||||
```
|
||||
### 如果一切顺利,那么该安装mtphotos了
|
||||
创建个目录
|
||||
```shell
|
||||
mkdir /opt/mtphotos
|
||||
```
|
||||
进入
|
||||
```shell
|
||||
cd /opt/mtphotos
|
||||
```
|
||||
创建并编辑docker-compose.yaml文件
|
||||
```shell
|
||||
vim docker-compose.yaml
|
||||
```
|
||||
按 I 进入编辑模式并填入以下内容
|
||||
```shell
|
||||
version: "3"
|
||||
|
||||
services:
|
||||
mtphotos:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/mtphotos/mt-photos:arm-latest
|
||||
container_name: mtphotos
|
||||
restart: unless-stopped
|
||||
network_mode: host
|
||||
volumes:
|
||||
- /opt/mtphotos/config:/config
|
||||
- /nvme/mtphotos/upload:/upload
|
||||
environment:
|
||||
- TZ=Asia/Shanghai
|
||||
- LANG=C.UTF-8
|
||||
dns:
|
||||
- 114.114.114.114
|
||||
depends_on:
|
||||
- mtphotos_ai
|
||||
- mtphotos_face_api
|
||||
mtphotos_ai:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/mtphotos/mt-photos-ai:arm-latest
|
||||
container_name: mtphotos_ai
|
||||
restart: unless-stopped
|
||||
network_mode: host
|
||||
environment:
|
||||
- API_AUTH_KEY=mt_photos_ai_extra
|
||||
mtphotos_face_api:
|
||||
image: crpi-gcuyquw9co62xzjn.cn-guangzhou.personal.cr.aliyuncs.com/devfox101/mt-photos-insightface-unofficial:arm-latest
|
||||
container_name: mtphotos_face_api
|
||||
restart: unless-stopped
|
||||
network_mode: host
|
||||
environment:
|
||||
- API_AUTH_KEY=mt_photos_ai_extra
|
||||
```
|
||||
按 Esc 退出编辑模式,输入 :wq 保存并退出
|
||||
拉取运行
|
||||
```shell
|
||||
docker compose up -d
|
||||
```
|
||||
## 如果一切顺利,那么到此结束
|
@@ -67,7 +67,7 @@ systemctl restart sshd
|
||||
```shell
|
||||
service ssh restart
|
||||
```
|
||||
##### 不要断开SSH连接,防止配置有问题连接不上
|
||||
##### **不要断开SSH连接,防止配置有问题连接不上**
|
||||
## 使用密钥对进行连接
|
||||
### 直接连接
|
||||
新开一个PowerShell终端
|
||||
@@ -89,17 +89,17 @@ noteapd config
|
||||
格式如
|
||||
```shell
|
||||
Host test
|
||||
HostName 192.168.21.5
|
||||
IdentityFile ~/.ssh/test
|
||||
User root
|
||||
HostName 192.168.21.5
|
||||
IdentityFile ~/.ssh/test
|
||||
User root
|
||||
```
|
||||
如果端口不是22,则需要加上端口,如ssh使用222端口
|
||||
```shell
|
||||
Host test
|
||||
HostName 192.168.21.5
|
||||
IdentityFile ~/.ssh/test
|
||||
Port 222
|
||||
User root
|
||||
HostName 192.168.21.5
|
||||
IdentityFile ~/.ssh/test
|
||||
Port 222
|
||||
User root
|
||||
```
|
||||
保存
|
||||
然后在PowerShell终端中就可以进行简便连接如
|
||||
|
Reference in New Issue
Block a user