Recalling the previous section: Docker (deploy common applications): docker deployment mysql
docker deployment redis: 4.0
# Download mirrors Docker pull Redis: 4.0 # View Download image Docker ImagesRF Royalty Free | grep Redis # boot image
docker run --name my-redis -p 16379:6379 -v /usr/local/workspace/redis/data:/data -d redis:4.0 redis-server --appendonly yes
Command Description:
--name after my-redis start container named my-redis
-p 16379: 3306 of the container 3306 to map the host port to port 16379
-v / usr / local / workspace / redis / data : / Data host / usr / local / workspace / redis / data directory is mounted to the container / var / lib / mysql
redis-server --appendonly yes startup command execution container redis-server, and open the redis persistence configuration
Check container starts circumstances
[root@k8s-master docker]# docker ps|grep redis f9eb2360ed36 redis:4.0 "docker-entrypoint.s?? 5 minutes ago Up 5 minutes 0.0.0.0:16379->6379/tcp my-redis
Redis into the container
# Enter redis container Docker Exec - IT f9eb2360ed36 bash # find redis execute scripts root @ f9eb2360ed36: / usr / local / bin # cd / usr / local / bin / root @ f9eb2360ed36: / usr / local / bin # LS - L Total 24528 X--rwxrwxr . 1 the root the root 374 On Jun . 11 06 : 46 is . EntryPoint Docker- SH -rwxr-X-XR . 1 the root Staff 1.28672 million On May 24 2017 gosu -rwxr-X-XR . 1 the root Staff 2.62864 million On Jun . 11 06 :48 redis-benchmark -rwxr-xr-x 1 root staff 6121232 Jun 11 06:48 redis-check-aof -rwxr-xr-x 1 root staff 6121232 Jun 11 06:48 redis-check-rdb -rwxr-xr-x 1 root staff 2820088 Jun 11 06:48 redis-cli lrwxrwxrwx 1 root staff 12 Jun 11 06:48 redis-sentinel -> redis-Server -rwxr-X-XR . 1 the root Staff 6121232 On Jun . 11 06 : 48 redis- Server # perform redis - CLI command to connect to the redis the root @ f9eb2360ed36: / usr / local / bin # ./redis- CLI # display information redis 127.0 . 0.1 : 6379 > info # Server redis_version: 4.0 . 14 redis_git_sha1: 00000000 redis_git_dirty: 0
Thanks for the support. thanks for watching