一、基础环境
1、操作系统:CentOS 7.3
2、Docker版本:Docker version 20.10.2,官方下载
二、docker安装
1、下载
wget https://download.docker.com/linux/static/stable/x86_64/docker-20.10.2.tgz
2、解压
tar -xvf docker-20.10.2.tgz
3、将解压出来的docker文件内容移动到 /usr/bin/ 目录下
cp docker/* /usr/bin/
4、将docker注册为service
vim /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
5、添加权限
chmod +x /etc/systemd/system/docker.service
6、重载配置文件
systemctl daemon-reload
7、启动
systemctl start docker
8、设置开机启动
systemctl enable docker.service
9、验证
systemctl status docker #查看Docker状态
docker -v #查看Docker版本
三、Docker安装MySQL
1、查看docker中MySQL镜像库
docker search mysql
2、拉取mysql:8.0镜像
docker pull mysql:8.0.23
3、拉取完毕,查看镜像
docker images
4、运行容器
docker run -itd --name mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 mysql
参数说明:
5、查看mysql容器
docker ps -a #查看所有容器
docker ps #查看正在运行的容器
6、修改mysql登录验证方式
6.1、 进入mysql容器
docker exec -it mysql bin/bash
6.2、登录mysql
mysql -u root -p
6.3、操作数据库
use mysql
6.4、查看用户信息
select host,user,plugin from user;
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '123456';
6.6、刷新数据库
flush privileges;
注:修改root验证登录方式,是因为mysql在8.0版本开始无法通过第三方工具链接数据库。
四、安装Docker-pan
Docker Hub: https://hub.docker.com/r/jaegerdocker/pan/
1、一键安装
运行命令:
docker run --name=pan -ti -p 8081:80 -p 6800:6800 jaegerdocker/pan
或者挂载数据卷,路径:/home/admin/pan/data
docker run --name=pan -v /data/pan:/home/admin/pan/data -ti -p 8081:80 -p 6800:6800 jaegerdocker/pan
2、访问地址:
注:如果是云服务器,进入控制台-》安全组-》用户组策略-》入站规则,在里面加入端口。
FileRun界面:
AriaNg界面:
其他问题:
结尾: