Permission Denied when start the Redis in docker from Windows OS - docker

Can anyone please explain what is the issue here and how to resolve that?
While I try to start the redis in docker desktop from windows OS, it always returning the error ""redis-redis-1 | 1:M 21 Jun 2022 14:40:59.452 # Can't open the append-only file: Permission denied
Here is my dockercompose file,
version: '2'
services:
redis:
image: 'docker.io/bitnami/redis:6.0-debian-10'
environment:
# ALLOW_EMPTY_PASSWORD is recommended only for development.
- ALLOW_EMPTY_PASSWORD=yes
- REDIS_DISABLE_COMMANDS=FLUSHDB,FLUSHALL
ports:
- '6379:6379'
volumes:
- '/home/vagrant/var/Redis:/bitnami/redis/data'
The second image is the files from the redis-data folder.

In your docker-compose file, change the line:
'/home/vagrant/var/Redis:/bitnami/redis/data'
to
./redis_data/:/bitnami/redis/data/
Since redis_data is the folder you are trying to mount to the container.

Related

Redis Docker-copmpose Can't handle RDB format version 10

I can't start redis container in my docker-compose file. I know that docker-compose file is OK, because my colleagues can start the project successfully. I read that there is a solution to delete dump.rdb file. But I can't find it. I use Windows machine. Any suggestions will be very helpful.
Error
2023-02-09 16:41:28 1:M 09 Feb 2023 13:41:28.699 # Can't handle RDB format version 10
Redis in docker_compose:
redis:
container_name: redis
hostname: redis
image: redis:5.0
ports:
- "6379:6379"
volumes:
- redis:/data
restart: always
The solution was very simple:
docker volume ls
docker volume rm <volume_name>

Docker-compose: Failed opening the temp RDB file temp-16.rdb (in server root dir /) for saving: Permission denied

I am using NodeJS + Express + Postgresql + Redis for my app.
My sql commands are working, but I am getting a permissions error when I am trying to update my redis cache:
cache | 16:C 27 Jun 2022 04:58:24.493 # Failed opening the temp RDB file temp-16.rdb (in server root dir /) for saving: Permission denied
cache | 1:M 27 Jun 2022 04:58:24.593 # Background saving error
Here is the cache portion of my docker-compose.yml:
cache:
container_name: cache
image: 'bitnami/redis:latest'
restart: always
ports:
- "6379:6379"
expose:
- 6379
command: redis-server --save 20 1 --loglevel warning --requirepass redis
volumes:
# - ./data:/data
- cache:/data
networks:
- my-network
I've read that the permissions must be set to read/write (obviously), but those that I found are for cases when using docker run. How can I do this using docker-compose?
Also, I don't think I have redis.conf. Any solutions that need it, can you please guide how to go about it?
Thanks!

How to setup maildev email persistant storage with docker

I'm setup maildev for my project using docker compose.
It is working correct, I able can sent email to maildev however I facing with an issue when setup Directory for persisting mails. I try to setup by the userguide but is not work. Email will be clear after restart docker.
This is maildev github: https://github.com/maildev/maildev
Maildev docker image: https://hub.docker.com/r/maildev/maildev
This is my docker-compose.yml file: mail-directory seem not working
version: '3.8'
services:
maildev:
hostname: maildev
command: bin/maildev --web 80 --smtp 25 --mail-directory /home/maildev/data
volumes:
- ./var/data/maildev:/home/maildev/data
ports:
- "1080:80"
networks:
- my-network
This is not yet possible in the latest Docker release (v1.1.0). This version of MailDev does not support the --mail-directory flag and will use a temporary directory of its choice instead.
The contents of this temporary directory is cleared each time MailDev is started so creating a volume for the this directory will not be beneficial.
I was able do achieve this with this configuration :
mailer:
image: maildev/maildev
volumes:
- /home/maildev:/home/maildev:rw
environment:
- MAILDEV_MAIL_DIRECTORY=/home/maildev
networks:
- default
The SMTP port will be 1025 and Web access to port 1080.
Hope this will help !

PhpStorm Docker remote PHP interpreter stops responding with message "Checking PHP Installation"

I'm trying to setup development environment using PhpStorm, Docker on Windows 10 machine.
When remote PHP interpreter selected PhpStorm stops responding with message "Checking PHP Installation":
docker-compose.yaml
version: '3'
networks:
symfony:
services:
#nginx
nginx-ea:
image: nginx:stable-alpine
container_name: nginx-ea
ports:
- "8081:80"
volumes:
- ./app:/var/www/project
- ./nginx/default.conf:/etc/nginx/conf.d/default.conf
depends_on:
- php74-fpm
- mysql8-ea
networks:
- symfony
# php74
php74-fpm:
build:
context: .
dockerfile: ./php/Dockerfile
container_name: php74-fpm
ports:
- "9001:9000"
volumes:
- ./app:/var/www/project
- ./php/conf:/usr/local/etc/php/
networks:
- symfony
php74-cli:
# define the directory where the build should happened,
# i.e. where the Dockerfile of the service is located
# all paths are relative to the location of docker-compose.yml
build:
context: ./php-cli
container_name: php74-cli
# reserve a tty - otherwise the container shuts down immediately
# corresponds to the "-i" flag
tty: true
# mount the app directory of the host to /var/www in the container
# corresponds to the "-v" option
volumes:
- ./app:/var/www/project
# connect to the network
# corresponds to the "--network" option
networks:
- symfony
# mysql 8
mysql8-ea:
image: mysql:8
container_name: mysql8-ea
ports:
- "4309:3306"
volumes:
- ./mysql:/var/lib/mysql
command: --default-authentication-plugin=mysql_native_password --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
restart: always # always restart unless stopped manually
environment:
MYSQL_USER: root
MYSQL_ROOT_PASSWORD: secret
MYSQL_PASSWORD: secret
networks:
- symfony
#PhpMyAdmin
phpmyadmin-ea:
image: phpmyadmin/phpmyadmin:5.0.1
container_name: phpmyadmin-ea
restart: always
environment:
PMA_HOST: mysql8-ea
PMA_USER: root
PMA_PASSWORD: secret
ports:
- "8090:80"
networks:
- symfony
Docker Desktop Windows 10 settings
Have tried selecting both php74-fpm container and php74-cli container, as soon as settings applied in PhpStorm it stops responding completely.
Any idea what is wrong in here?
UPDATE
Including PHPStorm logs from system\log\idea.log
# appears in logs when Remote PHP Interpreter settings applied
2020-11-27 09:14:00,859 [ 479670] DEBUG - php.config.phpInfo.PhpInfoUtil - Loaded helper: /opt/.phpstorm_helpers/phpinfo.php
2020-11-27 09:14:01,106 [ 479917] INFO - .CloudSilentLoggingHandlerImpl - Creating container...
2020-11-27 09:14:02,019 [ 480830] INFO - .CloudSilentLoggingHandlerImpl - Creating container...
2 Docker containers are created after Remote PHP Interpreter settings applied however they don't seem to be activating and logs inside the container doesn't seem to say anything
if try starting "phpstorm_helpers_PS-191.8026.56" container manually from docker desktop it seems to start ok
if I manually try to start "festive_zhukovsky..." container it doesn't start.
logs inside container prints xml:
https://drive.google.com/file/d/1d5XbkJdHnc7vuN0V7heJdx3lBkmJfs3V/view?usp=sharing
UPDATE 2
if i remove local PHP version which comes from xampp package in PHPStorm the windows on the right shows where PHPStorm is hanging and become unresponsive:
UPDATE 3
according to this article https://ollyxar.com/blog/docker-phpstorm-windows
Docker should have Shared Drives configuration
however I don't seem to have this option in Docker Desktop Settings:
Can this be a problem?

Docker compose error while creating mount source path

I have created a docker-compose.yml using cloudestuary. After downloading it and putting it in my Laravel project folder and running docker-compose up -d the download takes place and then I get this message:
ERROR: for worker-1 Cannot start service worker-1: error while creating mount source path '/var/www/html/lensin/html': mkdir /var/www: read-only file system
ERROR: for nginx Cannot start service nginx: error while creating mount source path '/var/www/html/lensin/html': mkdir /var/www: read-only file system
ERROR: for app Cannot start service app: error while creating mount source path '/var/www/html/lensin/html': mkdir /var/www: read-only file system
ERROR: for workspace Cannot start service workspace: error while creating mount source path '/var/www/html/lensin/html': mkdir /var/www: read-only file system
ERROR: Encountered errors while bringing up the project.
I`m on Ubuntu 17, and have tried even to set 777 to all folders, and running it with sudo, but the result is the same. I have also tried to move the file and to edit the volumes in yml.
Here is my docker compose file:
version: '2'
services:
nginx:
image: 'cloudestuary/nginx:mainline-fpm'
restart: always
environment:
CLIENT_MAX_BODY_SIZE: 100m
DOCUMENT_ROOT: /var/www/html/public
INDEX_FILE: index.php
PHP_FPM: app
networks:
- app
volumes:
- './html:/var/www/html'
ports:
- '80:80'
app:
image: 'cloudestuary/php-fpm:7.1'
restart: always
environment:
MAX_UPLOAD_FILE_SIZE: 100m
APP_URL: 'http://lensin.localhost'
APP_KEY: 'base64:2X9U1HiBdmfbwvZ4UkwUP/25svg7439HXKWL1F8Xn1c='
DB_CONNECTION: mysql
DB_HOST: mysql
DB_PORT: '3306'
DB_DATABASE: cloudestuary
DB_USER: cloudestuary
DB_PASSWORD: secret
networks:
- app
volumes:
- './html:/var/www/html'
workspace:
image: 'cloudestuary/php-workspace:7.1'
restart: always
ports:
- '2222:22'
environment:
MAX_UPLOAD_FILE_SIZE: 100m
APP_URL: 'http://lensin.localhost'
APP_KEY: 'base64:2X9U1HiBdmfbwvZ4UkwUP/25svg7439HXKWL1F8Xn1c='
DB_CONNECTION: mysql
DB_HOST: mysql
DB_PORT: '3306'
DB_DATABASE: cloudestuary
DB_USER: cloudestuary
DB_PASSWORD: secret
SSH_PASSWORD: xsKEVWXPrdAeg
networks:
- app
volumes:
- './html:/var/www/html'
worker-1:
image: 'cloudestuary/php-cli:7.1'
restart: always
networks:
- app
environment: { }
volumes:
- './html:/var/www/html'
command: 'php artisan queue:work'
mysql:
image: 'mysql:5.7'
restart: always
networks:
- app
environment:
MYSQL_ROOT_PASSWORD: toor
MYSQL_PASSWORD: secret
MYSQL_USER: cloudestuary
MYSQL_DATABASE: cloudestuary
volumes:
- 'mysql-data:/var/lib/mysql'
volumes:
mysql-data: { }
networks:
app: { }
It's likely a pathing issue with Docker when installed with snap, you're better off installing it with the official documentation from Docker.
Remove docker from snap
snap remove docker
Remove the docker directory, and old version (It's okay if these don't exist already)
rm -R /var/lib/docker
sudo apt-get remove docker docker-engine docker.io
Install the official docker package: https://docs.docker.com/install/linux/docker-ce/ubuntu/
Update: Since posting this answer, I've learnt that tools installed using snap are installed in a sandbox with limited permissions outside of that sandbox. This is likely the cause as docker won't have access to the external filesystem from its isolated sandbox environment.
Restart your docker service. Then the problem will solve.
sudo systemctl restart docker
What led me here was the Kubernetes V1VolumeMount. When deploying my application I was getting the same error format:
ERROR: for <pod_name> Cannot start <service_name>: error while creating mount source path '<source_path>': mkdir <dir_path>: read-only file system
At the start I was thinking permissions error as well, hence the message is a bit misleading. I turned out that I was trying to mount something that didn't exist in the source image. Hence, my uneducated suggestion would be, verify that what you are trying to mount does exist, if it doesn't you probably don't need that mount path.
P.S. I saw that there wasn't an accepted answer, so I am hoping that my contribution is not causing unnecessary cluttering.
Got this error but the issue was that the source path was a symlink. For some reason docker does not seem to like it, even after restarting the service.
Had to use a real path and then it worked just fine with Docker version 20.10.8 installed with snap.
For Docker on Windows 10, sometimes you have just to wait a while (1-5 min) before executing docker-compose up again.
Hope this will help someone else.

Resources