zoukankan      html  css  js  c++  java
  • docker安装并运行redis

      拉取镜像:

    [mall@VM_0_7_centos ~]$ sudo docker pull redis:3.2
    [sudo] password for mall: 
    3.2: Pulling from library/redis
    f17d81b4b692: Pull complete 
    b32474098757: Pull complete 
    8980cabe8bc2: Pull complete 
    58af19693e78: Pull complete 
    a977782cf22d: Pull complete 
    9c1e268980b7: Pull complete 
    Digest: sha256:7b0a40301bc1567205e6461c5bf94c38e1e1ad0169709e49132cafc47f6b51f3
    Status: Downloaded newer image for redis:3.2
    docker.io/library/redis:3.2

      docker运行redis:

    [mall@VM_0_7_centos ~]$ sudo docker run -p 6379:6379 --name redis -v /mydata/redis/data:/data -d redis:3.2 redis-server --appendonly yes
    55a9d1906429869ab46db6e889c44b5822f695ec81869f1cfc8f9ed0ddb48ee8

      参数说明:

      -p 6379:6379:端口映射,本地端口6379映射到docker容器端口6379

      --name redis:指定容器名称为redis

      -v /mydata/redis/data:/data:将容器的配置文件夹/data挂在到当前主机/mydata/redis/data

      -d -d redis:3.2 redis-server:以守护进程deamon运行redis服务器

      --appendonly yes:开启AOF模式持久化

      进入docker,使用redis客户端连接服务端:

    [mall@VM_0_7_centos ~]$ sudo docker exec -it redis redis-cli
    [sudo] password for mall: 
    127.0.0.1:6379> set hello world
    OK
    127.0.0.1:6379> get hello
    "world"
    127.0.0.1:6379> 
  • 相关阅读:
    日记功能发布
    功能小改进
    CuteEditor 6.0一个很奇怪的Bug
    关于博客园.NET俱乐部的公告
    新功能发布
    建立了一个博客园创业者QQ群
    思想决定生活 《卡耐基成功之道全书》读书笔记
    建立了一个英语学习小组
    实际上我没有选择的余地
    公告
  • 原文地址:https://www.cnblogs.com/wuxun1997/p/11769867.html
Copyright © 2011-2022 走看看