docker 两种安装方式.命令行.

命令行安装

如果你熟悉命令行,可能用 docker cli 更快捷

1
2
3
4
5
6
7
8
9
# 运行容器
docker run -d \
--restart unless-stopped \
--name countdown \
-p 3434:3000 \
-e TIMER_BACKGROUND="https://digwallpapers.com/wallpapers/full/3/a/2/32039-3840x2160-sci-fi-images-background-desktop-4k.jpg" \
-e TIMER_TARGET="Sat Nov 26 2022 06:00:00 GMT+0800" \
-e TIMER_TITLE="Business trip in Suzhou" \
yooooomi/easy-countdown

也可以用 docker-compose 安装,将下面的内容保存为 docker-compose.yml 文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
version: "3.8"

services:
web:
stdin_open: true # So that the serving is not exited with code 0
image: yooooomi/easy-countdown
container_name: countdown
restart: unless-stopped
ports:
- "3434:3000"
environment:
TIMER_BACKGROUND: "https://digwallpapers.com/wallpapers/full/3/a/2/32039-3840x2160-sci-fi-images-background-desktop-4k.jpg"
TIMER_TARGET: "Sat Nov 26 2022 06:00:00 GMT+0800"
TIMER_TITLE: "Business trip in Suzhou"

然后执行下面的命令

1
2
3
4
5
6
7
8
9
10
# 新建文件夹 countdown 目录
mkdir -p /volume2/docker/countdown

# 进入 countdown 目录
cd /volume2/docker/countdown

# 将 docker-compose.yml 放入当前目录

# 一键启动
docker-compose up -d