Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

README.md

Redis

This is a Docker Compose file for a Redis container based on the redis image. The following instructions are included:

  1. Use the version directive to specify the version of the Docker Compose file format that this file uses. In this case, we use version 3.8.
  2. Define a service for a Redis container. The image field specifies the Docker image to use for this service, which is set to redis:5.0.2-alpine.
  3. The restart field is set to always. This means that if the container is stopped, it will automatically start again.
  4. The ports section maps port 6379 of the host to port 6379 of the container. This allows you to access the Redis server through a web browser or REST client like curl.
  5. The command section specifies the parameters for starting the Redis server, including the password and logging level. You can modify these values according to your needs.
  6. The volumes section creates a named volume called cache, which is mounted at /data in the container. This allows data to persist even if the container is stopped and restarted.

Usage

  1. Save the Docker Compose file to a file named docker-compose.yml.
  2. Open a terminal window and navigate to the directory where you saved the Docker Compose file.
  3. Run the command docker-compose up to start the Redis container.
  4. Once the container is running, you can access it by connecting to port 6379 on the host machine using a web browser or a REST client like curl. The username and password for the database are specified in the command section of the Docker Compose file.
  5. To stop the Redis container, run the command docker-compose down.

Note that this Docker Compose assumes that you have already installed Docker on your system. If you haven't, you can download it from https://docs.docker.com/get-docker/.