docker run redis

#拉取 Redis 镜像
C:\Users\WYJ>docker pull redis
Using default tag: latest
latest: Pulling from library/redis
683abbb4ea60: Already exists
259238e792d8: Pull complete
78399601c709: Pull complete
f397da474601: Pull complete
c57de4edc390: Pull complete
b2ea05c9d9a1: Pull complete
Digest: sha256:5534b92530acc653f0721ebfa14f31bc718f68bf9070cbba25bb00bc7aacfabb
Status: Downloaded newer image for redis:latest

#查看拉取的镜像
C:\Users\WYJ>docker images
REPOSITORY                   TAG                 IMAGE ID            CREATED             SIZE
redis                        latest              71a81cb279e3        4 days ago          83.4MB

#运行镜像容器
C:\Users\WYJ>docker run -p 6379:6379 --name redis -v /d/docker/data/redis:/data  -d redis redis-server --appendonly yes
f7033e3efc840c921a125c8cdeb8c1747a75e7e950444c4265bf3d2fa0c3df7f

#查看运行容器日志
C:\Users\WYJ>docker logs redis
1:C 01 Jul 07:58:28.663 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
1:C 01 Jul 07:58:28.663 # Redis version=4.0.10, bits=64, commit=00000000, modified=0, pid=1, just started
1:C 01 Jul 07:58:28.663 # Configuration loaded
1:M 01 Jul 07:58:28.666 * Running mode=standalone, port=6379.
1:M 01 Jul 07:58:28.667 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
1:M 01 Jul 07:58:28.667 # Server initialized
1:M 01 Jul 07:58:28.667 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
1:M 01 Jul 07:58:28.668 * Ready to accept connections

#查看运行的容器
C:\Users\WYJ>docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                    NAMES
f7033e3efc84        redis               "docker-entrypoint.s…"   17 seconds ago      Up 15 seconds       0.0.0.0:6379->6379/tcp   redis

#进入容器内
C:\Users\WYJ>docker exec -it redis redis-cli
127.0.0.1:6379> 

 

转载于:https://www.cnblogs.com/code-Jun/p/9535213.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值