使用Docker安装Redis

1.进入Docker官网

https://hub.docker.com/php

2.在Docker官网上搜索Redis

在这里插入图片描述
这里使用 docker pull redis 默认使用的国外的仓库速度比较慢。因此这里推荐使用docker中国https://www.docker-cn.com/get-docker 进行加速
在这里插入图片描述python

在这里插入图片描述
就能够使用mysql

docker pull registry.docker-cn.com/library + 对应的组件进行加速
在这里插入图片描述web

在这里插入图片描述
出现了上面的这个问题。而这个问题是在docker中不支持使用HTTP请求或者是使用HTTPS的请求。那么怎么才能让Docker支持HTTP呢。就须要配置–insecure-registry选项才能够,并且配置完之后须要重启docker daemonredis

须要进入到/etc/docker中
查看有没有 daemon.json。这是docker默认的配置文件。
若是没有新建,若是有,则修改。sql

root# vi daemon.json
{
  "registry-mirrors": ["https://registry.docker-cn.com"]
}

在这里插入图片描述

[root@VM_0_2_centos ~]# service docker restart
Redirecting to /bin/systemctl restart docker.service
[root@VM_0_2_centos ~]# docker search centos
NAME                               DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
centos                             The official build of CentOS.                   5284      [OK]       
ansible/centos7-ansible            Ansible on Centos7                              121                  [OK]
jdeathe/centos-ssh                 CentOS-6 6.10 x86_64 / CentOS-7 7.5.1804 x...   108                  [OK]
consol/centos-xfce-vnc             Centos container with "headless" VNC sessi...   83                   [OK]
imagine10255/centos6-lnmp-php56    centos6-lnmp-php56                              53                   [OK]
centos/mysql-57-centos7            MySQL 5.7 SQL database server                   50                   
tutum/centos                       Simple CentOS docker image with SSH access      44                   
gluster/gluster-centos             Official GlusterFS Image [ CentOS-7 +  Glu...   40                   [OK]
openshift/base-centos7             A Centos7 derived base image for Source-To...   40                   
centos/postgresql-96-centos7       PostgreSQL is an advanced Object-Relationa...   37                   
centos/python-35-centos7           Platform for building and running Python 3...   34                   
kinogmt/centos-ssh                 CentOS with SSH                                 26                   [OK]
centos/httpd-24-centos7            Platform for running Apache httpd 2.4 or b...   22                   
openshift/jenkins-2-centos7        A Centos7 based Jenkins v2.x image for use...   20                   
centos/php-56-centos7              Platform for building and running PHP 5.6 ...   20                   
pivotaldata/centos-gpdb-dev        CentOS image for GPDB development. Tag nam...   10                   
openshift/wildfly-101-centos7      A Centos7 based WildFly v10.1 image for us...   6                    
openshift/jenkins-1-centos7        DEPRECATED: A Centos7 based Jenkins v1.x i...   4                    
darksheer/centos                   Base Centos Image -- Updated hourly             3                    [OK]
pivotaldata/centos                 Base centos, freshened up a little with a ...   3                    
pivotaldata/centos-mingw           Using the mingw toolchain to cross-compile...   2                    
pivotaldata/centos-gcc-toolchain   CentOS with a toolchain, but unaffiliated ...   1                    
blacklabelops/centos               CentOS Base Image! Built and Updates Daily!     1                    [OK]
smartentry/centos                  centos with smartentry                          0                    [OK]
jameseckersall/sonarr-centos       Sonarr on CentOS 7                              0                    [OK]

到这里上面那个问题算是解决完成。而后执行docker

docker pull registry.docker-cn.com/library/redisshell

获取对应的镜像获取完成以后使用docker image命令查看json

在这里插入图片描述

3.启动Redis

docker run -d -p 6379:6379 --name myredis registry.docker-cn.com/library/rediscentos

4.使用docker ps 查看进程

在这里插入图片描述