docker 在centos7下的安装
https://docs.docker.com/engine/install/centos/
docker 安装前准备
sudo yum install -y yum-utils
sudo yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
安装docker 可能会发是issue根据issue指示
sudo yum install docker-ce docker-ce-cli containerd.io --skip-broken
快速启动docker
sudo systemctl start docker
一些简单吗命令
···
docker -v #显示版本号
docker image #显示本地镜像
sudo systemctl enable docker #开机自启动docker
···
#镜像加速 https://cr.console.aliyun.com/cn-hangzhou/instances/mirrors
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://9wyyvd5z.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
#运行mysql 镜像
docker run -p 3308:3308 --name mysql \
-v /mydata/mysql/log:/var/log/mysql \
-v /mydata/mysql/data:/var/lib/mysql \
-v /mydata/mysql/conf:/etc/mysql \
-e MYSQL_ROOT_PASSWORD=root \
-d mysql:5.7
docker pull redis
#运行redis 镜像
mkdir -p /mydata/redis/conf
touch /mydata/redis/conf/redis.conf
-- redis 持久化
appendonly yes
docker run -p 6379:6379 --name redis \
-v /mydata/redis/data:/data \
-v /mydata/redis/conf/redis.conf:/etc/redis/redis.conf \
-d redis redis-server /etc/redis/redis.conf
--linux 测试redis是否启动
docker exec -it redis redis-cli
docker restart redus