$ cd /mydata
$ docker-compose up redis -d #指定redis 后台运行
[+] Running 1/1
⠿ Container redis Started
验证
[root@localhost ~]# docker exec -it redis redis-cli
127.0.0.1:6379> set name allen
(error) NOAUTH Authentication required.
127.0.0.1:6379> auth 123456
OK
127.0.0.1:6379> set name allen
OK
127.0.0.1:6379> get name
"allen"