GithubHelp home page GithubHelp logo

markshust / docker-magento2-php Goto Github PK

View Code? Open in Web Editor NEW
51.0 12.0 62.0 71 KB

This image is built from the official php repository and contains PHP configurations for Magento 2.

License: MIT License

Shell 92.72% PHP 7.28%

docker-magento2-php's Introduction

DEPRECATED

This repo has been migrated into https://github.com/markoshust/magento2-docker - please see this repo for future updates!

Versions

Description

This image is built from the official php repository and contains PHP configurations for Magento 2.

What's in this image?

This image installs the following base packages:

  • composer
  • php-fpm

This image also installs the following PHP extensions, which are the minimally required extensions to install and run Magento 2:

  • bcmath
  • gd
  • intl
  • mbstring
  • mcrypt
  • pdo_mysql
  • soap
  • xsl
  • zip

Variables

The following variables may be set to control the PHP environment:

  • PHP_MEMORY_LIMIT: (default 2048M) Set the memory_limit of php.ini
  • PHP_PORT: (default: 9000) Set a custom PHP port
  • PHP_PM: (default dynamic) Set the process manager
  • PHP_PM_MAX_CHILDREN: (default: 10) Set the max number of children processes
  • PHP_PM_START_SERVERS: (default: 4) Set the default number of servers to start at runtime
  • PHP_PM_MIN_SPARE_SERVERS: (default 2) Set the minumum number of spare servers
  • PHP_PM_MAX_SPARE_SERVERS: (default: 6) Set the maximum number of spare servers
  • APP_MAGE_MODE: (default: default) Set the MAGE_MODE

One-off containers

This image can run one-off PHP commands, such as:

docker run --rm --name php-test mageinferno/magento2-php echo "Hello world"

Application code is placed in /var/www/html. You can also attach a volume to that location, then run Magento-specific commands such as the Magento CLI tool:

docker run --rm --name mysite -v /Users/username/Sites/mysite/app/code:/var/www/html/app/code mageinferno/magento2-php:{PHPVERSION}-fpm-0 ./bin/magento

Docker Compose

Please see https://github.com/mageinferno/magento2-docker-compose for more detailed instructions and an example development environment using Docker Compose.

docker-magento2-php's People

Contributors

angeldm avatar dverkade avatar erfanimani avatar jasonhildebrand avatar markshust avatar mkovel avatar phedoreanu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

docker-magento2-php's Issues

Cannot create Composer cache dir's

Possible Composer cache retrieval error with fresh magento setup (host debian):

Logs when running initial setup:

Initializing setup...
Cannot create cache directory /var/www/.composer/cache/repo/https---repo.magento.com/, or directory is not writable. Proceeding without cache
Installing magento/project-community-edition (2.0.4)
Cannot create cache directory /var/www/.composer/cache/files/, or directory is not writable. Proceeding without cache
  - Installing magento/project-community-edition (2.0.4)
    Downloading: 100%         

Created project in .
Cannot create cache directory /var/www/.composer/cache/repo/https---repo.magento.com/, or directory is not writable. Proceeding without cache
Cannot create cache directory /var/www/.composer/cache/repo/https---packagist.org/, or directory is not writable. Proceeding without cache
Cannot create cache directory /var/www/.composer/cache/files/, or directory is not writable. Proceeding without cache

Setup still proceeds normally, it's possible this is not an issue.

Cannot save magento repo auth keys

I'm am trying the onelinesetup script to create a magento development environment. Everything appears to work until it gets to connecting to the magento repo. It appears the keys are not being saved.

I've read other posts that says the .composer directory errors are noise, but if the magento keys are saved to the composer global settings, and the script cannot create the global config.json file, that might explain the error...?

I tried to manually create the missing directories on the host, and chmod them to 777, but it did not appears to make any difference. Are these directories physical directories, or mounted/container directories?

Any advice appreciated. I'm trying this on Ubuntu 20.04.2 amd64, with Docker version 20.10.5, build 55c4c88

Here's a run of the onelinesetup:

[root@everest wirunc]# curl -s https://raw.githubusercontent.com/markshust/docker-magento/master/lib/onelinesetup | bash -s -- magento.test 2.4.2
mv: cannot move âcompose/binâ to â./binâ: Directory not empty
mv: cannot move âcompose/envâ to â./envâ: Directory not empty
mv: cannot move âcompose/.vscodeâ to â./.vscodeâ: Directory not empty
Initialized empty Git repository in /home/wirunc/.git/
Stopping wirunc_app_1           ... done
Stopping wirunc_phpfpm_1        ... done
Stopping wirunc_rabbitmq_1      ... done
Stopping wirunc_db_1            ... done
Stopping wirunc_elasticsearch_1 ... done
Stopping wirunc_redis_1         ... done
Starting wirunc_elasticsearch_1 ...
Starting wirunc_redis_1 ...
Starting wirunc_rabbitmq_1 ...
Starting wirunc_db_1 ... done
Starting wirunc_phpfpm_1 ... done
Starting wirunc_app_1 ... done

Composer authentication required (repo.magento.com public and private keys):
    Username: <redacted>193dc
    Password: <redacted>de2d1

Composer auth has been setup.
Cannot create cache directory /var/www/.composer/cache/repo/https---repo.packagist.org/, or directory is not writable. Proceeding without cache
Cannot create cache directory /var/www/.composer/cache/files/, or directory is not writable. Proceeding without cache
Cannot create cache directory /var/www/.composer/cache/repo/https---repo.magento.com/, or directory is not writable. Proceeding without cache
Creating a "magento/project-community-edition=2.4.2" project at "./"
Warning from repo.magento.com: You haven't provided your Magento authentication keys. For instructions, visit https://devdocs.magento.com/guides/v2.3/install-gde/prereq/connect-auth.html
Warning from repo.magento.com: You haven't provided your Magento authentication keys. For instructions, visit https://devdocs.magento.com/guides/v2.3/install-gde/prereq/connect-auth.html
Warning from repo.magento.com: You haven't provided your Magento authentication keys. For instructions, visit https://devdocs.magento.com/guides/v2.3/install-gde/prereq/connect-auth.html


  [Composer\Downloader\TransportException]
  The 'https://repo.magento.com/packages.json' URL required authentication.
  You must be using the interactive console to authenticate


create-project [-s|--stability STABILITY] [--prefer-source] [--prefer-dist] [--repository REPOSITORY] [--repository-url REPOSITORY-URL] [--add-repository] [--dev] [--no-dev] [--no-custom-installers] [--no-scripts] [--no-progress] [--no-secure-http] [--keep-vcs] [--remove-vcs] [--no-install] [--ignore-platform-reqs] [--] [<package>] [<directory>] [<version>]

[root@everest wirunc]#

I verified that my access keys (taken from https://marketplace.magento.com/customer/accessKeys/) are correct:

Public Key: _redacted_193dc
Private Key: redacted de2d1

stuck at Updating dependencies (including require-dev)

I tried to install using : mageinferno/magento2-php:7.0-fpm-1 image
but got stuck at this :

Initializing setup...
Installing magento/project-community-edition (2.1.6)
 - Installing magento/project-community-edition (2.1.6) Loading from cache
Created project in .
Loading composer repositories with package information
Updating dependencies (including require-dev)

any idea how to solve this ?

ZIP package is not installed

ZIP package is not installed, but the ZIP extension is. This will probably result in some issues. Install the ZIP package as wel..

Magento is unable to be installed via composer

Hi there, I'm facing the issue with mogento installation.
/home/tiko/.composer/auth.json with credentials to magento and github is available and mounted in appdata container.

tiko@dell:~/dev/magento2-docker-compose$ docker-compose run --rm setup
Starting magento2dockercompose_appdata_1
Starting magento2dockercompose_dbdata_1
Initializing setup...


  [Composer\Downloader\TransportException]                                                                                                            
  The "https://repo.magento.com/packages.json" file could not be downloaded: php_network_getaddresses: getaddrinfo failed: Name or service not known  
  failed to open stream: php_network_getaddresses: getaddrinfo failed: Name or service not known                                                      

Thanks for any help,
ps: I was able to install magento with this docker-composer on last week (from the scratch). But can't anymore.

Install Git for Composer `--prefer-source` option.

I'm not sure whether this is intended as a dev/CI/CD or production container, but Git would be very useful (essential) in case Composer cannot download a release and has to check out a repository's source.

Git would be useful in dev/ci/cd environments, but not production. I don't think this intended for production regardless, because you don't need Composer on a prod server.. So this addition should be welcome - correct me if I'm wrong.

Maybe add en exception for tracking, if 'docker-compose run --rm setup' was not executed, while fresh 'up' executed.

This all while building from current docker-compose.
My bad,
This all is because I looked-over docker-compose run --rm setup.

Maybe add an exception for stupid people, like me?

Syndrome:
In setup-config:

if [ -d $WWW_DIR/bin ] && [ ! -f $WWW_DIR/bin/magento-php ]; then
  mv $WWW_DIR/bin/magento $WWW_DIR/bin/magento-php
  cp /usr/local/bin/magento $WWW_DIR/bin/
fi

[ ! -f $WWW_DIR/bin/magento-php ] is true.

But then,
while doing mv $WWW_DIR/bin/magento $WWW_DIR/bin/magento-php

seems there is no $WWW_DIR/bin/magento, so then no $WWW_DIR/bin/magento-php file.

And then: cp /usr/local/bin/magento $WWW_DIR/bin/ is a successful command

So now /srv/www/bin/magento exists and it runs:

/usr/local/bin/php /srv/www/bin/magento-php $*

But there is no magento-php.

So result of all that is:

  • no /srv/www/bin/magento-php
  • but exist /srv/www/bin/magento copied from /usr/local/bin/magento wich is a wrapper of nonexistent
    magento-php.

And then Cron perpetually runs:
/usr/local/bin/php $WWW_DIR/bin/magento-php cron:run
AND
/usr/local/bin/php $WWW_DIR/bin/magento-php setup:cron:run

So PHP perpetually reports:

Could not open input file: /srv/www/bin/magento-php

Also this happens:
#28

theme-adminhtml-backend dependency error

i get this error (clean installation):

  • Installing magento/theme-adminhtml-backend (100.0.2)
    [ErrorException]
    copy(/src/vendor/magento/theme-adminhtml-backend/9846f5db99e277168a14632938f71431.zip): failed to open stream: No such file or directory

thanks

Mail Sending

Hi Mark,

thank you for this project. It gave us a great inspiration how to dockerize Magento2.

One questions remains: how to you handle sending emails? What are the best options?

Thanks for an answers ... even if this issue maybe incorrectly placed 8-)

Cyrill

Crons not properly running

Somewhere along the way of a PHP update, crons stopped running. This message is presented at startup:

cron: can't open or create /var/run/crond.pid: Permission denied

for command:

docker exec -it CONTAINER_ID su -c "/usr/local/bin/setup-config" -s /bin/sh www-data

Better repo layout for contributions

Does anyone have any ideas for a better repo layout for managing all of these docker images? I almost always have to go ahead and re-commit proposed changes/pr's because this php image lives in two branches, a 5.x and 7.x.

Perhaps this layout, where each version is in a different folder as opposed to a branch?
https://github.com/mageinferno/docker-magento2-php/php5
https://github.com/mageinferno/docker-magento2-php/php7

I'm super heavy on tagging & releasing properly, but it makes it tough with two different versions. Perhaps this should be broken out into two separate repos?

Would like community feedback!

cron.php not exist, so perpetual cron/php Error happen: 'Could not open input file: /srv/www/update/cron.php'

In setup-config:

Cron perpetually runs:

/usr/local/bin/php $WWW_DIR/update/cron.php

But there is no file

/srv/www/update/cron.php

So php perpetually says in phpfpm_1 container:

Could not open input file: /srv/www/update/cron.php

P.S.


NOR there is no 'cron.php' anywhere in /srv/www/ volume:

find . -name "*cron*"
./dev/tests/integration/testsuite/Magento/Email/Model/_files/design/adminhtml/Magento/default/Magento_ProductAlert/email/cron_error.html
./vendor/magento/module-cron
./vendor/magento/module-cron/etc/crontab
./vendor/magento/module-catalog-rule-configurable/etc/crontab
./vendor/magento/module-catalog-rule/etc/crontab
./vendor/magento/module-captcha/etc/crontab

Setup:upgrade cleaning error

When I try to run a setup:upgrade I found this error:

Cache cleared successfully
File system cleanup:
/srv/www/var/generation/Composer
/srv/www/var/generation/Magento
/srv/www/var/generation/Symfony
The directory '/srv/www/var/di/' doesn't exist - skipping cleanup
Updating modules:

[Magento\Framework\Exception\FileSystemException]
File "/srv/www/app/etc/config.php" cannot be opened Warning!file_get_contents(/srv/www/var/cache//mage-tags/mage---f6e_INTERCEPTION): failed to open stream: No such file or directory

It seems that it doesn't work using the alias magento command specified in the magento2-docker-compose repo ( alias magento='docker-compose exec phpfpm ./bin/magento' )
Could you fix that issue please?

Install Xdebug

Hi Mark,

As this is a development environment, for most people it would be crucial to have xdebug installed on the php containers.

I have been able to get it running using something similar to this:

FROM mageinferno/magento2-php:7.0.5-fpm-0

RUN pecl install xdebug-beta && \
    docker-php-ext-enable xdebug

RUN touch /usr/local/etc/php/conf.d/xdebug.ini
RUN echo "zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20151012/xdebug.so" >> /usr/local/etc/php/conf.d/xdebug.ini
RUN echo "xdebug.remote_enable=1" >> /usr/local/etc/php/conf.d/xdebug.ini
RUN echo "xdebug.remote_host=192.168.0.13" >> /usr/local/etc/php/conf.d/xdebug.ini

Big problem here is the ip. There is still no official Docker way to fetch the host's ip, at least none i could find. In any case it is still better to have something like this than having no xdebug or having to manually install xdebug every time you create the containers...

Do you see a better way to enable xdebug remote debugging than this one?

Cheers,
Gabriel

Gulp compiling compatibility

Due tough frontend development and better compiling with gulp nodejs extensions, what do you think about to install npm and gulp globally by default?
In addition what do you think about to install all required nodejs extensions reading from the root file gulpfile.js if present (maybe directly in the setup of the project) ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.