Docker - deploy MySQL, Redis

MySQL deployment

Pull MySQL mirror

docker pull mysql:5.7

Creating MySQL container

RUN -DI --name = MySQL Docker -p 33306: 3306 -e MYSQL_ROOT_PASSWORD = 123456 MySQL
 # here to do a mapping
  • The -p port mapping, port mapping format host: port container runtime
  • -e Add the environment variable MYSQL_ROOT_PASSWORD on behalf of the root user's login password

Telnet mysql, connected to the host's IP, specify port 3306

 Redis deployment

Mirror Pull

docker pull redis

 Support remote connections

  • Creating conf folder and data in the host
  • Create a file in the conf redis.conf, the internal write
0.0.0.0 the bind # Bind address 
daemonize NO 
protected -mode NO # run a remote connection 
requirepass 123456 # password is 123456

Create a container

docker run -p 6379:6379 --name redis_6379 -v /home/test/redis/conf/redis.conf:/etc/redis/redis.conf -v /home/test/redis/data:/data -d redis:alpine3.11 redis-server /etc/redis/redis.conf --appendonly yes

Guess you like

Origin www.cnblogs.com/waller/p/12109143.html