linux进程entrypoint可变,错误:启动容器进程导致“ exec:” / docker-entrypoint.sh“:权限被拒绝”...

我正在尝试构建docker-compose,但出现此错误:

ERROR: for indicaaquicombrold_mysqld_1 Cannot start service mysqld:

oci runtime error: container_linux.go:247: starting container process

caused"exec: \"/docker-entrypoint.sh\": permission denied"

ERROR: for mysqld Cannot start service mysqld: oci runtime error:

container_linux.go:247: starting container process caused"exec:

\"/docker-entrypoint.sh\": permission denied"

ERROR: Encountered errors while bringing up the project.

docker-compose.yml

version: '3'

services:

php:

build:

context: ./docker/php

image: indicaaqui.com.br:tag

volumes:

- ./src:/var/www/html/

- ./config/apache-config.conf:/etc/apache2/sites-enabled/000-default.conf

ports:

-"80:80"

-"443:443"

mysqld:

build:

context: ./docker/mysql

environment:

- MYSQL_DATABASE=db_indicaaqui

- MYSQL_USER=indicaqui

- MYSQL_PASSWORD=secret

- MYSQL_ROOT_PASSWORD=docker

volumes:

- ./config/docker-entrypoint.sh:/docker-entrypoint.sh

- ./database/db_indicaaqui.sql:/docker-entrypoint-initdb.d/db_indicaaqui.sql

Dockerfile(PHP)

FROM php:5.6-apache

MAINTAINER Limup

CMD ["php" ]

RUN docker-php-ext-install pdo_mysql

# Enable apache mods.

# RUN a2enmod php5.6

RUN a2enmod rewrite

# Expose apache.

EXPOSE 80

EXPOSE 443

# Use the default production configuration

# RUN mv"$PHP_INI_DIR/php.ini-production""$PHP_INI_DIR/php.ini"

RUN mv"$PHP_INI_DIR/php.ini-development""$PHP_INI_DIR/php.ini"

# Override with custom opcache settings

# COPY ./../../config/php.ini $PHP_INI_DIR/conf.d/

# Manually set up the apache environment variables

ENV APACHE_RUN_USER www-data

ENV APACHE_RUN_GROUP www-data

ENV APACHE_LOG_DIR /var/log/apache2

ENV APACHE_LOCK_DIR /var/lock/apache2

ENV APACHE_PID_FILE /var/run/apache2.pid

# Update the PHP.ini file, enable ?> tags and quieten logging.

RUN sed -i"s/short_open_tag = Off/short_open_tag = On/""$PHP_INI_DIR/php.ini"

RUN sed -i"s/error_reporting = .*$/error_reporting = E_ERROR | E_WARNING | E_PARSE/""$PHP_INI_DIR/php.ini"

RUN a2dissite 000-default.conf

RUN chmod -R 777 /etc/apache2/sites-enabled/

WORKDIR /var/www/html/

# By default start up apache in the foreground, override with /bin/bash for interative.

CMD ["/usr/sbin/apache2ctl","-D","FOREGROUND"]

Dockerfile(MySQL)

FROM mariadb:latest

RUN chmod -R 777 /docker-entrypoint.sh

ENTRYPOINT ["/docker-entrypoint.sh"]

EXPOSE 3306

CMD ["mysqld"]

请帮我解决这个问题!

有任何想法吗?

您可以尝试将属性nocopy复制到卷吗? 例如:code datavolume:/ var / lib / mysql:nocopy code

这很可能是config/docker-entrypoint.sh上的Linux文件权限问题。 如果您的主机是Linux / Mac,则可以运行:

chmod 755 config/docker-entrypoint.sh

有关Linux权限的更多信息,请参见以下有用的文章:https://www.linux.com/learn/understanding-linux-file-permissions

这行得通! 谢谢! 但是..现在我有一个新错误apache2:/etc/apache2/apache2.conf的第225行的语法错误:无法打开配置文件/etc/apache2/sites-enabled/000-default.conf:权限被拒绝

chmod +x configdocker-entrypoint.sh就足够了

@Limup相同的问题,不同的容器。 您的文件未配置为在桌面上全球可读。 chmod 644 configapache-config.conf。 考虑阅读chmod和Linux权限。

@TruongDang Im在权限中是明确的,以防万一还有其他位设置不正确,例如Shell脚本不能被世界范围读取。

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值