安装docker,docker-compose

1
2
3
4
5
6
7
8
9
10
11
12
13
14
#安装docker
wget -qO- get.docker.com | bash
#检验docker安装成功
docker -v
#启动docker
systemctl enable docker
#安装docker-compose
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
#添加可执行权限:x
sudo chmod +x /usr/local/bin/docker-compose
#在/usr/bin/路径下创建软连接
ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
#检验docker-copose安装成功
docker-compose --version

docker-compose代码:

1
2
3
4
5
6
7
8
9
10
version: '3.3'

services:
uptime-kuma:
image: louislam/uptime-kuma
container_name: uptime-kuma
volumes:
- ./uptime-kuma:/app/data
ports:
- 3001:3001

宝塔用户的话,添加下面的配置到nginx配置文件里

1
2
3
4
5
6
7
8
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://127.0.0.1:3001/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}

访问http://ip:3001