执行后:
docker-compose up -d
当我进入容器并执行任何bash cammand时,此消息消失:
“ bash:组:找不到命令”
obs .: 我的操作系统是fedora 29,
Docker版本18.09.0, build 4d60db4
docker-compose版本1.23.2, build 1110ad01
dockerfile:
FROM ubuntu:14.04
WORKDIR /var/www/html
RUN apt-get update && apt-get upgrade -y
RUN apt-get install -y \
software-properties-common \
python-software-properties \
curl \
build-essential \
vim \
sudo \
whois \
# Install node and npm
RUN curl -sL https://deb.nodesource.com/setup_9.x | sudo -E bash -
RUN apt-get install -y nodejs
RUN add-apt-repository ppa:ondrej/php
RUN apt-get update
# Install apache
RUN apt-get install apache2 -y
RUN a2enmod rewrite
# Install PHP and modules
RUN apt-get install -y --force-yes \
php7.2 \
php-pear \
php7.2-curl \
php7.2-dev \
php7.2-gd \
php7.2-mbstring \
php7.2-zip \
php7.2-xml \
php7.2-xdebug \
php7.2-bcmath \
php7.2-pgsql \
php7.2-mysql
# Install Composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
# Config Apache
RUN echo "ServerName localhost" >> /etc/apache2/apache2.conf
RUN sed -i '/<Directory \/>/,/<\/Directory>/ s/AllowOverride None/AllowOverride All/' /etc/apache2/apache2.conf
RUN sed -i '/<Directory \/usr\/share>/,/<\/Directory>/ s/AllowOverride None/AllowOverride All/' /etc/apache2/apache2.conf
RUN sed -i '/<Directory \/var\/www\/>/,/<\/Directory>/ s/AllowOverride None/AllowOverride All/' /etc/apache2/apache2.conf
# Config php.ini
RUN sed -i 's/^short_open_tag\s*=\s*Off/short_open_tag = On/g' /etc/php/7.2/apache2/php.ini
RUN sed -i 's/^post_max_size\s*=\s*8M/post_max_size = 256M/g' /etc/php/7.2/apache2/php.ini
RUN sed -i 's/^memory_limit\s*=\s*128M/memory_limit = 256M/g' /etc/php/7.2/apache2/php.ini
RUN sed -i 's/^upload_max_filesize\s*=\s*2M/upload_max_filesize = 20M/g' /etc/php/7.2/apache2/php.ini
RUN echo "session.save_path = /tmp" >> /etc/php/7.2/apache2/php.ini
RUN sed -i 's/^serialize_precision\s*=\s*17/serialize_precision = 100/g' /etc/php/7.2/apache2/php.ini
RUN sed -i 's/^display_startup_errors\s*=\s*Off/display_startup_errors = On/g' /etc/php/7.2/apache2/php.ini
RUN sed -i 's/^session.gc_probability\s*=\s*0/session.gc_probability = 1/g' /etc/php/7.2/apache2/php.ini
RUN sed -i 's/^session.bug_compat_42\s*=\s*Off/session.bug_compat_42 = On/g' /etc/php/7.2/apache2/php.ini
RUN sed -i 's/^session.bug_compat_warn\s*=\s*Off/session.bug_compat_warn = On/g' /etc/php/7.2/apache2/php.ini
RUN sed -i 's/^display_errors\s*=\s*Off/display_errors = On/g' /etc/php/7.2/apache2/php.ini
RUN sed -i '/error_reporting = E_ALL & ~E_DEPRECATED/c\error_reporting = E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_WARNING' /etc/php/7.2/apache2/php.ini
RUN sed -i 's/^;track_errors\s*=\s*Off/track_errors = On/g' /etc/php/7.2/apache2/php.ini
RUN sed -i 's/^html_errors\s*=\s*Off/html_errors = On/g' /etc/php/7.2/apache2/php.ini
RUN sed -i '/;error_log = php_errors.log/c\error_log = "\/var\/www\/logs\/php_error_log"' /etc/php/7.2/apache2/php.ini
# Config xdebug
RUN echo "xdebug.remote_enable=1" >> /etc/php/7.2/apache2/conf.d/20-xdebug.ini \
&& echo "xdebug.remote_autostart=1" >> /etc/php/7.2/apache2/conf.d/20-xdebug.ini \
&& echo "xdebug.var_display_max_depth = -1" >> /etc/php/7.2/apache2/conf.d/20-xdebug.ini \
&& echo "xdebug.var_display_max_children = -1" >> /etc/php/7.2/apache2/conf.d/20-xdebug.ini \
&& echo "xdebug.var_display_max_data = -1" >> /etc/php/7.2/apache2/conf.d/20-xdebug.ini
RUN chgrp -R www-data /var/www
RUN chmod -R 777 /var/www
EXPOSE 80 8080 631 8000 3000
CMD ["/usr/sbin/apache2ctl", "-D", "FOREGROUND"]
泊坞窗撰写:
version: "3"
services:
php7:
image: anapassos/php7
container_name: php7
volumes:
- ./php7/www:/var/www/html
ports:
- "8080:80"
- "443:443"
environment:
XDEBUG_CONFIG: remote_host=192.168.5.72
答案 0 :(得分:0)
我刚刚按照评论中的David Maze的建议删除了该小组,因为那对我有用。非常感谢!