docker-compose install redis

1. Create docker-compose.yml under the redis directory

You can use xftp to directly right-click to add a new file, or you can use the xshell command to enter the redis directory and execute the following command

 

 

The cracked version of xhell6 and xftp6 can be downloaded https://download.csdn.net/download/qq_37557563/13051450

 

Copy the following code into docker-compose.yml

version: '3'
services:
    redis:
      image: redis:5.0.0
      container_name: redis
      command: redis-server --requirepass 123456
      ports:
        - "16379:6379"
      volumes:
        - ./data:/data

 

2. Execute the following command in the directory where the yml file is located to start the container

Go to the redis directory and run

docker-compose up -d

3. View the container

 

docker ps

  

 

Use redis connection tool to connect redis to the next redis management tool

4. Detailed explanation of the docker-compose.yml file
image: redis:5.0.0 means to use redis5.0.0 to mirror the
container_name: redis specifies the name of the container as redis
command: redis-server --requirepass 123456 specifies the password for redis as 123456
ports will be the container Port 6379 is mapped to port 16379 of the host. Volumes are
used to specify the storage volume. The container and the host can share files through the storage volume.


 

Guess you like

Origin blog.csdn.net/qq_37557563/article/details/109765186