linux 离线安装docker及导入导出mysql镜像
linux 离线安装docker及导入导出mysql镜像
一,linux 离线安装docker
docker 和 mysql5.7镜像
链接:https://pan.baidu.com/s/1CyrfxQi46mi3UFSvi4CXyw
提取码:16i8
操作系统:CentOS 7
查看防火墙状态
firewall防火墙
1、查看firewall服务状态
systemctl status firewalld
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 #添加文件权限并启动docker
systemctl daemon-reload #重新加载配置文件
systemctl start docker #启动Docker
systemctl enable docker.service #设置开机自启
6、验证
systemctl status docker #查看Docker状态
docker -v #查看Docker版本
二 :docker 离线安装mysql
docker 导出镜像:
1,找一台已经安装mysql的linux服务
执行命令:docker images
(导出得镜像名称 docker镜像名称中间有空格,不能有点比如:mysql5.7.gz)
启动mysql
docker run -d -p 3306:3306 --name mymysql -e MYSQL_ROOT_PASSWORD=root 镜像名称:版本号
(-e MYSQL_ROOT_PASSWORD设置密码)
进入mysql容器内部 docker exec -it 34fbb /bin/sh
执行命令mysql -uroot -p 输入密码 执行SHOW DATABASES;
修改远程权限:alter user 'root'@'%' identified with mysql_native_password by 'root';
查看数据库 执行exit 退出容器
mysql 安装成功
linux 离线安装docker及导入导出mysql镜像相关教程