下面是实现在docker中启动redis并进入的步骤:
首先需要通过docker搜索与redis有关的镜像源docker search redis
接着我们通过Docker下载Redis镜像源docker pull redis
这里没有设置版本好就会默认下载latest的镜像源。[root@localhost ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
docker.io/tomcat latest aeea3708743f 9 days ago 529 MB
docker.io/rabbitmq latest 2b5cda43d345 2 weeks ago 151 MB
docker.io/elasticsearch 7.6.0 5d2812e0e41c 2 weeks ago 790 MB
docker.io/redis latest 44d36d2c2374 2 weeks ago 98.2 MB
docker.io/mysql latest 791b6e40940c 2 weeks ago 465 MB
[root@localhost ~]#
接着创建并启动Redis容器
首先启动Docker[root@localhost ~]# systemctl start docker
在Docker中启动Redis
这里我们没有设置容器的别名,-d代表后台启动。[root@localhost ~]# docker