.查看本页面的前提条件来验证你的CentOS 版本是否支持 Docker 。
通过 uname -r 命令查看你当前的内核版本
uname -r
centos7 修改国内软件源
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo_bak
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
yum makecache
yum -y update
root
权限登录 Centos。确保 yum 包更新到最新。sudo yum update
sudo yum remove docker docker-common docker-selinux docker-engine
yum install -y yum-utils device-mapper-persistent-data lvm2
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum list docker-ce --showduplicates | sort -r
yum install -y docker-ce
systemctl start docker
systemctl enable docker
curl -L "https://github.com/docker/compose/releases/download/1.23.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
此处因为是使用github下载,所以可能比较慢
chmod +x /usr/local/bin/docker-compose
docker-compose --version
ifconfig
docker swarm init --advertise-addr 192.168.164.151
这里推荐安装新版docker
修改Docker的配置文件来设置加速地址
vim /etc/docker/daemon.json
{
"registry-mirrors": ["https://br10hqrl.mirror.aliyuncs.com"]
}
如果没有文件就新建一个
使配置文件生效
systemctl daemon-reload && systemctl restart docker
docker node ls #检查节点 ID
docker node update --label-add name=linux-1 <节点 ID>
firewall-cmd --zone=public --add-port=6490/tcp --permanent
firewall-cmd --zone=public --add-port=28000-28100/tcp --permanent
或者暴力点
firewall-cmd --zone=public --add-port=1-65535/tcp --permanent
重启防火墙,重载设置
service firewalld restart
注意,这里防火墙不能关闭,因为需要用到iptables
yum install git
git clone -b single https://github.com/glzjin/CTFd.git
cd CTFd
vi frp/frps.ini # token 一定要随机
vi frp/frpc.ini # token 一定要随机
git submodule update --init
修改ctfd
目录下Dockerfile
文件
FROM python:3.7-alpine
WORKDIR /opt/CTFd
RUN mkdir -p /opt/CTFd /var/log/CTFd /var/uploads
RUN sed -i 's/dl-cdn.alpinelinux.org/mirror.tuna.tsinghua.edu.cn/g' /etc/apk/repositories && \
apk update && \
apk add \
linux-headers \
libffi-dev \
gcc \
make \
musl-dev \
py-pip \
mysql-client \
git \
openssl-dev
COPY . /opt/CTFd
RUN pip install -r requirements.txt -i https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple/
RUN for d in CTFd/plugins/*; do \
if [ -f "$d/requirements.txt" ]; then \
pip install -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com -r $d/requirements.txt; \
fi; \
done;
RUN chmod +x /opt/CTFd/docker-entrypoint.sh
RUN adduser -D -u 1001 -s /bin/sh ctfd
RUN chown -R 1001:1001 /opt/CTFd /var/log/CTFd /var/uploads
USER 1001
EXPOSE 8000
ENTRYPOINT ["/opt/CTFd/docker-entrypoint.sh"]
修改原文件的python
和python-dev
删除或者添加版本
修改requirements.txt
删除gevent
的版本信息
修改/root/CTFd/CTFd/themes/core/static/css
下fonts.dev.css
和fonts.min.css
将找到文件中的
https://use.fontawesome.com/releases/v5.9.0/css/all.css
替换 为
https://cdn.bootcss.com/font-awesome/5.13.0/css/all.css
Frp Config Template,记得修改 token:
[common]
token = randomme
server_addr = 172.1.0.1
server_port = 6490
pool_count = 200
tls_enable = true
admin_addr = 172.1.0.3
admin_port = 7400
https://blog.csdn.net/TangXuZ/article/details/100082144
https://www.cnblogs.com/ruanqin/p/11082506.html
https://www.jianshu.com/p/df75f9b5fcf6
https://www.jianshu.com/p/77c4c62d9afe
https://www.zhaoj.in/read-6333.html#
https://juejin.im/post/5dc5811ff265da4d02626e3c
82144
https://www.cnblogs.com/ruanqin/p/11082506.html
https://www.jianshu.com/p/df75f9b5fcf6
https://www.jianshu.com/p/77c4c62d9afe
https://www.zhaoj.in/read-6333.html#
https://juejin.im/post/5dc5811ff265da4d02626e3c
https://www.zhaoj.in/read-6259.html
赵师傅nb!