修改README文件
This commit is contained in:
67
README.md
67
README.md
@@ -403,36 +403,7 @@ sudo dnf install docker-ce -y && docker -v
|
||||
sudo systemctl enable --now docker && systemctl status docker
|
||||
```
|
||||
|
||||
### 下载并解压代码文件
|
||||
|
||||
``` shell
|
||||
wget https://gitcode.junlan.site/junlan/RemoveWeeklyShapshot/archive/Dev.zip && unzip Dev.zip && cd removeweeklyshapshot/
|
||||
```
|
||||
|
||||
``` shell
|
||||
[junlan@localhost removeweeklyshapshot]$ tree
|
||||
.
|
||||
├── compose.yaml
|
||||
├── config
|
||||
│ ├── config.yaml
|
||||
│ └── settings.py
|
||||
├── core
|
||||
│ ├── data_exporter.py
|
||||
│ ├── get_vm_snapshots.py
|
||||
│ ├── remove_snapshots.py
|
||||
│ └── vm_connector.py
|
||||
├── Dockerfile
|
||||
├── main.py
|
||||
├── README.md
|
||||
├── requirements.txt
|
||||
├── utils
|
||||
│ └── logger.py
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### 构建 Dockerfile 文件
|
||||
### Dockerfile 文件
|
||||
|
||||
``` dockerfile
|
||||
cat << 'EOF' > Dockerfile
|
||||
@@ -440,14 +411,16 @@ FROM python:3.14.3-slim
|
||||
# 配置时区
|
||||
ENV TZ=Asia/Shanghai
|
||||
RUN ln -fs /usr/share/zoneinfo/$TZ /etc/localtime && dpkg-reconfigure -f noninteractive tzdata
|
||||
# 切换目录
|
||||
WORKDIR /removeweeklysnapshot/
|
||||
# 复制代码
|
||||
COPY ./ /removeweeklysnapshot/
|
||||
# 下载代码
|
||||
ADD https://gitcode.junlan.site/junlan/RemoveWeeklyShapshot/archive/Dev.tar.gz /app/
|
||||
# 解压压缩文件
|
||||
RUN tar -xzf /app/Dev.tar.gz -C /app/ && rm /app/Dev.tar.gz
|
||||
# 设置工作目录
|
||||
WORKDIR /app/removeweeklyshapshot
|
||||
# 安装必要的软件和 python 库
|
||||
RUN apt-get update && apt-get install procps tzdata -y && pip install -r requirements.txt && chmod +x /removeweeklysnapshot/main.py
|
||||
RUN apt-get update && apt-get install procps tzdata -y && pip install -r requirements.txt && chmod +x main.py
|
||||
# 容器内执行启动程序
|
||||
CMD ["python3", "/removeweeklysnapshot/main.py"]
|
||||
CMD ["python3", "/app/removeweeklyshapshot/main.py"]
|
||||
EOF
|
||||
```
|
||||
|
||||
@@ -468,7 +441,7 @@ services:
|
||||
volumes:
|
||||
- '/var/removeweeklysnapshot/logs:/removeweeklysnapshot/logs'
|
||||
- '/var/removeweeklysnapshot/output:/removeweeklysnapshot/output'
|
||||
# - '/var/removeweeklysnapshot/config:/removeweeklysnapshot/config'
|
||||
# - '/var/removeweeklysnapshot/config/:/removeweeklysnapshot/config'
|
||||
restart: always
|
||||
stdin_open: true
|
||||
tty: true
|
||||
@@ -484,8 +457,26 @@ sudo docker compose up -d
|
||||
### 查看状态
|
||||
|
||||
``` shell
|
||||
[junlan@localhost removeweeklyshapshot]$ sudo docker images
|
||||
[junlan@localhost ~]$ sudo docker history removeweeklysnapshot
|
||||
IMAGE CREATED CREATED BY SIZE COMMENT
|
||||
87caa20a7e92 51 seconds ago CMD ["python3" "/app/removeweeklyshapshot/ma… 0B buildkit.dockerfile.v0
|
||||
<missing> 51 seconds ago RUN /bin/sh -c apt-get update && apt-get ins… 240MB buildkit.dockerfile.v0
|
||||
<missing> About a minute ago WORKDIR /app/removeweeklyshapshot 0B buildkit.dockerfile.v0
|
||||
<missing> 40 minutes ago RUN /bin/sh -c tar -xzf /app/Dev.tar.gz -C /… 73.7kB buildkit.dockerfile.v0
|
||||
<missing> 59 minutes ago ADD https://gitcode.junlan.site/junlan/Remov… 16.4kB buildkit.dockerfile.v0
|
||||
<missing> 59 minutes ago RUN /bin/sh -c ln -fs /usr/share/zoneinfo/$T… 1.66MB buildkit.dockerfile.v0
|
||||
<missing> 59 minutes ago ENV TZ=Asia/Shanghai 0B buildkit.dockerfile.v0
|
||||
<missing> 2 weeks ago CMD ["python3"] 0B buildkit.dockerfile.v0
|
||||
<missing> 2 weeks ago RUN /bin/sh -c set -eux; for src in idle3 p… 0B buildkit.dockerfile.v0
|
||||
<missing> 2 weeks ago RUN /bin/sh -c set -eux; savedAptMark="$(a… 40.5MB buildkit.dockerfile.v0
|
||||
<missing> 2 weeks ago ENV PYTHON_SHA256=a97d5549e9ad81fe17159ed02c… 0B buildkit.dockerfile.v0
|
||||
<missing> 2 weeks ago ENV PYTHON_VERSION=3.14.3 0B buildkit.dockerfile.v0
|
||||
<missing> 2 weeks ago RUN /bin/sh -c set -eux; apt-get update; a… 4.35MB buildkit.dockerfile.v0
|
||||
<missing> 2 weeks ago ENV PATH=/usr/local/bin:/usr/local/sbin:/usr… 0B buildkit.dockerfile.v0
|
||||
<missing> 2 weeks ago # debian.sh --arch 'amd64' out/ 'trixie' '@1… 85.9MB debuerreotype 0.17
|
||||
|
||||
|
||||
[junlan@localhost removeweeklyshapshot]$ sudo docker images
|
||||
IMAGE ID DISK USAGE CONTENT SIZE EXTRA
|
||||
python:3.14.3-slim 486b8092bfb1 176MB 45.5MB
|
||||
removeweeklysnapshot:latest 6f17fcaaef99 512MB 140MB
|
||||
|
||||
Reference in New Issue
Block a user