我安装magento使用 composer :
composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition
和加载示例数据。它在本地主机上运行得非常好。
我为magento创建了dockerfile和docker-compose:停靠文件:
FROM ubuntu:latest
MAINTAINER xxxx
RUN apt-get -qqy update
RUN apt-get -qqy install apache2 \
php \
mysql-client \
libapache2-mod-php \
php-pear \
php-mcrypt \
php-gd \
php-curl \
php-mysql \
php-dom \
php-xml \
php-xsl \
php-mbstring \
php-intl \
php-zip \
php-cli \
php-cgi \
curl \
git \
nano \
vim \
htop
RUN apt-get -qqy install nodejs npm
RUN apt-get -qqy install php-fpm
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
ADD ./20-mcrypt.ini /etc/php/7.0/cli/conf.d/20-mcrypt.ini
ADD ./20-mcrypt.ini /etc/php/7.0/apache2/conf.d/20-mcrypt.ini
RUN a2enmod rewrite
COPY ./magento2.conf /etc/apache2/sites-available/magento2.conf
# RUN rm -f /etc/apache2/sites-enabled/000-default.conf
# COPY xdebug-enabler.ini /etc/php/7.0/mods-available/
RUN php -r "echo ini_get('memory_limit').PHP_EOL;"
COPY ./apache2.conf /etc/apache2/apache2.conf
RUN a2enmod php7.0
RUN service apache2 restart
WORKDIR /var/www/html
EXPOSE 9001
EXPOSE 80
EXPOSE 443
magento2.conf:
<VirtualHost *:80>
DocumentRoot /var/www/html
ServerName magento2test.localhost
<Directory /var/www/html>
DirectoryIndex index.php index.html
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
allow from all
</Directory>
</VirtualHost>
apache2.conf:
#
# The accept serialization lock file MUST BE STORED ON A LOCAL DISK.
#
Mutex file:${APACHE_LOCK_DIR} default
PidFile ${APACHE_PID_FILE}
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 5
User ${APACHE_RUN_USER}
HostnameLookups Off
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
# Include module configuration:
IncludeOptional mods-enabled/*.load
IncludeOptional mods-enabled/*.conf
# Include list of ports to listen on
Include ports.conf
<Directory />
Options FollowSymLinks
AllowOverride None
Require all denied
</Directory>
<Directory /usr/share>
AllowOverride None
Require all granted
</Directory>
<Directory /var/www/>
Options +Indexes +FollowSymLinks +Multiviews
allowOverride all
Require all granted
</Directory>
<IfModule dir_module>
DirectoryIndex index.php index.php3 index.html index.htm
</IfModule>
AccessFileName .htaccess
<FilesMatch "^\.ht">
Require all denied
</FilesMatch>
LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
IncludeOptional conf-enabled/*.conf
IncludeOptional sites-enabled/*.conf
最后进行Docker-Composer:
mageweb:
build: docker-files/apache-xdebug
command: rm -f /var/run/apache2/apache2.pid
command: apachectl -D FOREGROUND
ports:
- "8081:8081"
- "80:80"
- "9001:9001"
- "443:443"
volumes:
- ./project/:/var/www/html/
现在它只有一个图像,因为我使用远程mysql,我会添加更多的图像后。
无论如何,我能够建立和启动docker。我能够安装和设置magento。当然,我尝试刷新所有缓存,并做了所有这些命令(使用docker exec -it container_name bash:
php bin/magento setup:static-content:deploy
php bin/magento indexer:reindex
php bin/magento setup:upgrade --keep-generated
php bin/magento module:enable --all
php bin/magento setup:di:compile
但是style.css和一些js没有加载属性:https://postimg.org/image/wla49rvrz/
system.log:
[2016-11-17 07:27:39] main.INFO: Cache file with merged layout: LAYOUT_frontend_STORE1_2ae0e2a835d549823c9720ea0833000d3 and handles default, catalog_category_view, catalog_category_view_type_default, catalog_category_view_type_default_without_children, catalog_category_view_id_39: Please correct the XML data and try again. [] []
[2016-11-17 07:27:39] main.INFO: Cache file with merged layout: LAYOUT_frontend_STORE1_2a7ccd8094436548b564a588f6303121c and handles 2columns-left: Please correct the XML data and try again. [] []
[2016-11-17 07:27:40] main.INFO: Cache file with merged layout: LAYOUT_frontend_STORE1_26f1b068ec7ccf4878f9284dd1137afd1 and handles catalog_product_prices: Please correct the XML data and try again. [] []
当我尝试更改Docker容器上项目的权限时,它不适用。可能是因为Windows的缘故吗?
你有什么想法热我可以解决它吗?
2条答案
按热度按时间pes8fvy91#
最后我解决了它。
下面是我的Apache/php文档:
和Apache 2配置文件:
nbnkbykc2#
这是我的Dockerfile支持PHP-FMP:
所以这是我的存储库,看看吧!
https://github.com/dylanops/docker-magento