docker启动mysql8和redis

cat > /srv/mysql/my.cnf <
docker run \
  --name mysql8 \
  -p 3306:3306 \
  -v /srv/mysql/data:/var/lib/mysql \
  -v /srv/mysql/log:/var/log/mysql \
  -v /srv/mysql/my.cnf:/etc/mysql/my.cnf:rw \
  -e MYSQL_ROOT_PASSWORD=$PassWord \
  --restart=always \
  -d mysql:8.0.16
cat > /srv/redis/redis.conf <
docker run -p 6379:6379 --name redis \
 -v /srv/redis/redis.conf:/etc/redis/redis.conf  \
 --restart=always \
 -d redis redis-server /etc/redis/redis.conf 
apt-get install mysql-client
apt-get install redis-tools

你可能感兴趣的:(容器,redis,docker,数据库)