I am getting a permission denied error when trying to start up my containers using docker-compose.
Error: PermissionError: [Errno 13] Permission denied: '/var/www/sites/api/var/lib/mysql/mysql' [1503] Failed to execute script docker-compose
Dockerfile:
FROM php:7.2-apache
COPY httpd.conf /etc/apache2/sites-available/
RUN a2dissite 000-default.conf
RUN a2ensite httpd.conf
RUN a2enmod rewrite
RUN mkdir /var/www/sites/api
RUN chmod -R 777 /var/www/sites/api
COPY . /var/www/sites/api
RUN apt-get update && \
docker-php-ext-install mysqli && \ apt-get clean && \ apt-get install
-y libmagickwand-dev --no-install-recommends && rm -rf /var/lib/apt/lists/* RUN printf "\n"
| pecl install imagick
RUN docker-php-ext-enable imagick
CMD ["/usr/sbin/apache2ctl", "-D","FOREGROUND"]
Docker-compose:
version: '3'
services:
qa_api_test:
build:
context: ./
ports:
- "80:80"
db:
image: mysql:5.7
volumes:
- /var/lib/mysql:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=xxxx
ports:
- "3306:3306"
Try running sudo docker-compose up -d
. Mind the sudo
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.