Level 102
Show your docker-compose.yml file
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi, I use Laravel Sail. I need change redis configutation in container. How it possible?
Show your docker-compose.yml file
# For more information: https://laravel.com/docs/sail
version: '3'
services:
laravel.test:
build:
context: ./docker/8.0
dockerfile: Dockerfile
args:
WWWGROUP: '${WWWGROUP}'
image: sail-8.0/app
ports:
- '${APP_PORT:-80}:80'
environment:
WWWUSER: '${WWWUSER}'
LARAVEL_SAIL: 1
volumes:
- '.:/var/www/html'
networks:
- sail
depends_on:
- mysql
- redis
mysql:
image: 'mysql:8.0'
ports:
- '${FORWARD_DB_PORT:-3306}:3306'
environment:
MYSQL_ROOT_PASSWORD: '${DB_PASSWORD}'
MYSQL_DATABASE: '${DB_DATABASE}'
MYSQL_USER: '${DB_USERNAME}'
MYSQL_PASSWORD: '${DB_PASSWORD}'
MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
volumes:
- 'sailmysql:/var/lib/mysql'
networks:
- sail
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-p${DB_PASSWORD}"]
retries: 3
timeout: 5s
redis:
image: 'redis:alpine'
ports:
- '6381:6379'
volumes:
- 'sailredis:/data'
- ./redis/redis.conf:/usr/local/etc/redis/redis.conf
command:
- redis-server /usr/local/etc/redis/redis.conf
networks:
- sail
healthcheck:
test: [ "CMD", "redis-cli", "ping" ]
networks:
sail:
driver: bridge
volumes:
sailmysql:
driver: local
sailredis:
driver: local
when i start: Fatal error, can't open config file 'redis-server /usr/local/etc/redis/redis.conf': No such file or directory
@777not888 Personally I would create a Dockerfile and reference that. Then inside that I would copy over the needed file
In the redis folder, add a new file called Dockerfile and add this content
FROM redis:alpine
COPY redis.conf /usr/local/etc/redis/
and link to it in the service
redis:
build: ./redis
ports:
- '6381:6379'
volumes:
- 'sailredis:/data'
command:
- redis-server /usr/local/etc/redis/redis.conf
networks:
- sail
healthcheck:
test: [ "CMD", "redis-cli", "ping" ]
Please or to participate in this conversation.