本次实践为个人测试环境,操作系统版本为centos7.6。
hostname | IP地址 | 操作系统版本 | Docker版本 |
---|---|---|---|
jeven | 192.168.3.166 | centos 7.6 | 20.10.17 |
1.本次实践部署环境为个人测试环境,生产环境请谨慎使用;
2.在Docker环境下成功部署homarr个人导航页。
检查Docker服务是否正常运行,确保Docker正常运行。
[root@jeven ~]# systemctl status docker
● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
Active: active (running) since Mon 2023-08-07 23:25:04 CST; 14h ago
Docs: https://docs.docker.com
Main PID: 11587 (dockerd)
Tasks: 10
Memory: 135.7M
检查Docker版本
[root@jeven ~]# docker version
Client: Docker Engine - Community
Version: 20.10.17
API version: 1.41
Go version: go1.17.11
Git commit: 100c701
Built: Mon Jun 6 23:05:12 2022
OS/Arch: linux/amd64
Context: default
Experimental: true
Server: Docker Engine - Community
Engine:
Version: 20.10.17
API version: 1.41 (minimum version 1.12)
Go version: go1.17.11
Git commit: a89b842
Built: Mon Jun 6 23:03:33 2022
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.6.6
GitCommit: 10c12954828e7c7c9b6e0ea9b0c02b01407d3ae1
runc:
Version: 1.1.2
GitCommit: v1.1.2-0-ga916309
docker-init:
Version: 0.19.0
GitCommit: de40ad0
检查Docker compose版本,确保2.0以上版本。
[[root@jeven ~]# docker compose version
Docker Compose version v2.19.1
在docker hub下载homarr镜像 ghcr.io/ajnart/homarr:latest
如果镜像拉取缓慢,可使用我仓库的swr.cn-north-4.myhuaweicloud.com/jeven/homarr:latest镜像。
[root@jeven ~]# docker pull ghcr.io/ajnart/homarr:latest
latest: Pulling from ajnart/homarr
31e352740f53: Already exists
11d56374b943: Pull complete
03c6b1d5f51e: Pull complete
d4fe5e85fcdf: Pull complete
0404ea77c3f1: Pull complete
901c3b6f9e06: Pull complete
d75131c3fd40: Pull complete
0b9d27af4cb0: Pull complete
ea9ea30b8736: Pull complete
b981932a56ab: Pull complete
Digest: sha256:441556ea9d52a12fc96811da73e832c3a477e3e4defd880dfe96bd32f1a7b520
Status: Downloaded newer image for ghcr.io/ajnart/homarr:latest
ghcr.io/ajnart/homarr:latest
mkdir -p /data/homarr/configs && mkdir -p /data/homarr/icons
使用docker run快速创建homarr容器
docker run \
--name homarr \
--restart unless-stopped \
-p 7666:7575 \
-v /data/homarr/configs:/app/data/configs \
-v /data/homarr/icons:/app/public/icons \
-v /var/run/docker.sock:/var/run/docker.sock \
-d ghcr.io/ajnart/homarr:latest
检查homarr容器运行状态
[root@jeven homarr]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f0dfb29fd905 ghcr.io/ajnart/homarr:latest "docker-entrypoint.s…" 20 seconds ago Up 19 seconds 0.0.0.0:7666->7575/tcp, :::7666->7575/tcp homarr
检查容器运行日志
[root@jeven homarr]# docker logs homarr
Listening on port 7575 url: http://f0dfb29fd905:7575
访问地址:http://192.168.3.166:7666
将IP地址改为自己服务器的IP地址。
在设置选项,选择语言为中文。
进入编辑模式——添加apps,添加网址https://github.com/,添加完毕,可以正常打开自定义网址。
在设置中,设置搜索网址为https://www.baidu.com/s?ie=UTF-8&wd=
设置主页天气城市位置,选择北京,保存即可。