1、安装docker
1.1卸载旧版本docker
sudo yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine
1.2 设置安装源
sudo yum install -y yum-utils
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
1.3 安装
sudo yum install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
1.4 启动docker
sudo systemctl start docker
1.5 验证安装
sudo docker run hello-world
2、安装docker-compose
2.1 下载docker-compose
https://github.com/docker/compose/releases/download/v2.20.3/docker-compose-linux-x86_64
2.2 移动到/usr/local/bin目录
mv docker-compose-linux-x86_64 /usr/local/bin
2.3 修改安装包名称
mv docker-compose-linux-x86_64 docker-compose
2.4 查看docker-compose版本号
docker-compose version
2.5 设置docker开机启动
systemctl enable docker
3、部署seafile
3.1 下载docker-compose.yml文件,位置 /opt
Seafile Cloudhttps://docs.seafile.com/d/cb1d3f97106847abbf31/files/?p=/docker/docker-compose.yml
3.2 修改docker-compose.yml文件
version: '2.0'
services:
db:
image: mariadb:10.5
container_name: seafile-mysql
environment:
- MYSQL_ROOT_PASSWORD=123456 # MySQL root账户密码.
- MYSQL_LOG_CONSOLE=true
volumes:
- /opt/seafile-mysql/db:/var/lib/mysql # MySQL 数据存储目录.
networks:
- seafile-netmemcached:
image: memcached:1.6
container_name: seafile-memcached
entrypoint: memcached -m 256
networks:
- seafile-netseafile:
image: seafileltd/seafile-mc:10.0.1 # seafile版本号
container_name: seafile
ports:
- "6188:80" # 6188宿主机端口号
# - "443:443" # If https is enabled, cancel the comment.
volumes:
- /opt/seafile-data:/shared # Seafile 数据存储目录.
environment:
- DB_HOST=db
- DB_ROOT_PASSWD=123456 #MYSQL密码,和上面的相同.# - TIME_ZONE=Asia/Shanghai # 时区,默认UTC.
- [email protected] # Seafile 用户名
- SEAFILE_ADMIN_PASSWORD=asecret # Seafile 密码
- SEAFILE_SERVER_LETSENCRYPT=false # 是否使用 lets encrypt SSL证书.
- SEAFILE_SERVER_HOSTNAME=192.168.1.168 # 主机名.
depends_on:
- db
- memcached
networks:
- seafile-net
3.3 部署seafile
在docker-compose.yml文件所在目录执行命令,本次安装位置:/opt
docker-compose up -d
设置开机启动容器
cd /etc/profile.d
vim seafile.sh 内容如下:
docker-compose -f /opt/docker-compose.yml up -d
3.4 查看seafile日志
docker logs seafile
3.5 登录seafile
http://ip:端口号