外观
Docker安装到UOS
系统环境
UOS(v.20) 专业版(1043)
安装 docker 步骤
注意模板系统的类型 AMD ARM?32?64?
- 1.开启开发者模式。
- 上传电脑信息,下载证书 https://www.chinauos.com/developMode
- 重启
- 2.下载 docker 安装包解压
arch查看系统位数- 下载地址 :
tar -xvf docker.tgz
Docker 安装
# 1.解压
tar -xvf docker.tgz
# 2.移动文件
sudo cp docker/* /usr/bin
# 3.启动docker守护进程 可能会报错,需要去uos系统中允许程序运行
cd /usr/bin
docker &
# 4.添加到系统服务,赋予权限
cp docker.service /etc/systemd/system
cd /etc/systemd/system
sudo chmod +x /etc/systemd/system/docker.service
# 5.重载配置文件
systemctl daemon-reload
# 6.启动docker
sysetmctl start docker
# 7.开机启动docker
systemctl enable docker.service
# 8.查看docker状态
systemctl status docker
docker -v
# 如果报错没权限 permission denied
chmod 777 /var/run/docker.sock镜像导入
# mysql
# 创建网络 使用别名指向
docker run -d --network archive --network-alias addrmysql -p 3306:3306 --name mysql --restart always -v /opt/mysql/data:/var/lib/mysql -v /opt/mysql/conf.d:/etc/mysql/conf.d -e TZ=Asia/Shanghai -e MYSQL_ROOT_PASSWORD=uos@123 arm64v8/mysql:latest --lower_case_table_names=1
create database wyarchive;
mysql -u root -p wyarchive < w.sql;
# nginx
docker load < nginx.tar
docker run --name nginx --restart always -v /opt/nginx/html:/usr/share/nginx/html -d -p 8080:80 nginx:1.22
docker run --name nginx -v /opt/nginx/html:/usr/share/nginx/html -d -p 8080:80 nginx:1.22
# 将dist解压到opt/nginx/html下
# 基础环境与api
docker load < net-5.0-slim.tar
docker load < wy_jbland_api.tar
docker run --network archive --network-alias addrarchiveapi --name=wy_jbland_api --restart always -p 8003:8003 -v /home/hikvision/档案文件:/app/wwwroot/uploads -e LANG=C.UTF-8 wyarchive_api:latest
docker update --restart always [containerid]- /etc/systemd/system/docker.service
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network-online.target firewalld.service
Wants=network-online.target
[Service]
Type=notify
# the default is not to use systemd for cgroups because the delegate issues still
# exists and systemd currently does not support the cgroup feature set required
# for containers run by docker
ExecStart=/usr/bin/dockerd
ExecReload=/bin/kill -s HUP $MAINPID
# Having non-zero Limit*s causes performance problems due to accounting overhead
# in the kernel. We recommend using cgroups to do container-local accounting.
LimitNOFILE=infinity
LimitNPROC=infinity
LimitCORE=infinity
# Uncomment TasksMax if your systemd version supports it.
# Only systemd 226 and above support this version.
#TasksMax=infinity
TimeoutStartSec=0
# set delegate yes so that systemd does not reset the cgroups of docker containers
Delegate=yes
# kill only the docker process, not all processes in the cgroup
KillMode=process
# restart the docker process if it exits prematurely
Restart=on-failure
StartLimitBurst=3
StartLimitInterval=60s
[Install]
WantedBy=multi-user.target