Giter Site home page Giter Site logo

docker-magento2's Introduction

Docker Image for Magento Open Source 2

ko-fi

This repo ONLY maintains Docker images for Magento Open Source 2.4.x. You may still found Docker images for old versions in the old registry.

Starting from Magento 2.4.x, container images are now hosted in GitHub Container Registry.

This repo provides Docker images for different Magento 2.4 versions. Refer to this page to see all available versions.

Version Container image
2.4.6-p3 ghcr.io/alexcheng1982/docker-magento2:2.4.6-p3
2.4.5-p5 ghcr.io/alexcheng1982/docker-magento2:2.4.5-p5
2.4.4-p6 ghcr.io/alexcheng1982/docker-magento2:2.4.4-p6

This docker image is based on my docker-apache2-php8 image for Apache 2 and PHP 8. Please refer to the image label php_version for the actual PHP version. In general, Magento uses PHP 8.1 starting from 2.4.4. Versions 2.4.2 and 2.4.3 use PHP 7.4. Please refer to the label php_version of the image to get the actual PHP version.

This docker image is based on phusion/baseimage-docker with Ubuntu 22.04 LTS. The reason to use phusion/baseimage-docker is to support multiple processes, which is important to get cron jobs working in Magento.

Please note: this Docker image is for Magento 2 related development and testing only, not ready for production use. Setting up a Magento 2 production server requires more configurations. You can use this image as the base to build customized images.

Magento 2 Installation Types

Magento 2.4 can be installed using Composer or git. The git-based installation mode is used for contributor of Magento. This Docker image uses Composer as the installation type, so the Web Setup Wizard can be used.

Below are some basic instructions.

Quick Start

The easiest way to start Magento 2 with MySQL is using Docker Compose. Just clone this repo and run the following command in the directory of a specific version. For example, go to versions/2.4.6-p3 for Magento 2.4.6-p3.

The default docker-compose.yaml uses MySQL, phpMyAdmin, and OpenSearch.

$ docker compose up -d

For admin username and password, please refer to the file env. You can also change the file env to update those configurations. Below are the default configurations.

MYSQL_HOST=db
MYSQL_ROOT_PASSWORD=myrootpassword
MYSQL_USER=magento
MYSQL_PASSWORD=magento
MYSQL_DATABASE=magento

MAGENTO_LANGUAGE=en_GB
MAGENTO_TIMEZONE=Pacific/Auckland
MAGENTO_DEFAULT_CURRENCY=NZD
MAGENTO_URL=http://local.magento
MAGENTO_BACKEND_FRONTNAME=admin
MAGENTO_USE_SECURE=0
MAGENTO_BASE_URL_SECURE=0
MAGENTO_USE_SECURE_ADMIN=0

MAGENTO_ADMIN_FIRSTNAME=Admin
MAGENTO_ADMIN_LASTNAME=MyStore
[email protected]
MAGENTO_ADMIN_USERNAME=admin
MAGENTO_ADMIN_PASSWORD=magentorocks1

OPENSEARCH_HOST=opensearch

For example, if you want to change the default currency, just update the variable MAGENTO_DEFAULT_CURRENCY, e.g. MAGENTO_DEFAULT_CURRENCY=USD.

To get all the possible values of MAGENTO_LANGUAGE, MAGENTO_TIMEZONE and MAGENTO_DEFAULT_CURRENCY, run the corresponding command shown below:

Variable Command
MAGENTO_LANGUAGE bin/magento info:language:list
MAGENTO_TIMEZONE bin/magento info:timezone:list
MAGENTO_DEFAULT_CURRENCY bin/magento info:currency:list

For example, to get all possible values of MAGENTO_LANGUAGE, run

$ docker run --rm -it ghcr.io/alexcheng1982/docker-magento2:2.4.6-p3 info:language:list

You can find all available options in the official guide. If you need more options, fork this repo and add them in bin\install-magento.

Please see the following video for a quick demo.

Use Magento 2 with Docker

Installation

After starting the container, you'll see the setup page of Magento 2. You can use the script install-magento to quickly install Magento 2. The installation script uses the variables in the env file. Use docker ps to find the container name;

Magento 2

$ docker exec -it <container_name> install-magento

Sample data

$ docker exec -it <container_name> install-sampledata

Database

The default docker-compose.yml uses MySQL as the database and starts phpMyAdmin. The default URL for phpMyAdmin is http://localhost:8580. Use MySQL username and password to log in.

MySQL 8.0.0 is used as the default database version.

Usage

After Magento 2 is installed, open a browser and navigate to http://local.magento/. For admin access, navigate to http://local.magento/admin/ and log in using the admin username and password specified in the env file. Default admin username and password are admin and magentorocks1, respectively. Two-factor authentication is disabled.

Running on Windows

When running on Windows, the port 80 may be occupied by built-in IIS or ASP.NET server. The following command finds ID of the process that occupies port 80.

netstat -ano -p TCP | find /I"listening" | find /I"80"

Then taskkill /F /PID <pid> can be used to kill the process to free the port.

FAQ

How to use a different port?

If the default port 80 cannot be used for some reasons, you can change to a different port. Simply change the MAGENTO_URL from http://local.magento to add the port number, for example, http://local.magento:8080. You may also need to modify docker-compose.yaml file to update the exported port of the Magento container.

How to keep installed Magento?

You can add a volume to folder /var/www/html, see the docker-compose.yml file.

volumes: 
  - magento-data:/var/www/html 

Where is the database?

Magento 2 cannot run without a database. This image is for Magento 2 only. It doesn't contain a MySQL server. A MySQL server should be started in another container and linked with Magento 2 container. It's recommended to use Docker Compose to start both containers. You can also use Kubernetes or other tools.

Why accessing http://local.magento?

For development and testing in the local environment, using localhost as Magento 2 URL has some issues. The default env file use http://local.magento as the value of MAGENTO_URL. You need to edit your hosts file to add the mapping from local.magento to localhost. You can use any domain names as long as it looks like a real domain, not localhost.

If localhost doesn't work, try using 127.0.0.1.

127.0.0.1    local.magento

How to update Magento 2 installation configurations?

Depends on how the container is used,

  • When using the GUI setup page of Magento 2, update configurations in the UI.
  • When using the script, update configurations in the env file.
  • When starting Magento 2 as a standalone container, use -e to pass environment variables.

Why getting access denied error after changing the default DB password?

If you change the default DB password in env file and get the access denied error when installing Magento 2, see this issue comment.

Develop and test using this Docker image

As I mentioned before, this Docker image is primarily used for development and testing. Depends on the tasks you are trying to do, there are different ways to use this Docker image.

Extensions and themes

You can keep the extensions and themes directories on your local host machine, and use Docker Compose volumes to install the extensions and themes. For example, if you have a theme in the directory /dev/mytheme, you can install it by specifying it in the docker-composer.yaml file. Then you can see the theme in Magento admin UI.

version: '3.0'
services:
  web:
    image: ghcr.io/alexcheng1982/docker-magento2:2.4.6-p3
    ports:
      - "80:80"
    links:
      - db
    env_file:
      - env
    volumes:
      - /dev/mytheme:/var/www/html/app/design/frontend/mytheme/default

Modify Magento core files

If you want to modify Magento core files, you cannot modify them directly in the container. Those changes will be lost. It's also not recommended to update Magento core files directly, which makes upgrading Magento a painful process. Actually, Docker makes the process much easier if you absolutely need to modify some core files. You can use volumes to overwrite files.

For example, if you want to overwrite the file app/code/Magento/Catalog/Block/Product/Price.php, you can copy the content to a new file in your local directory /dev/mycode/magento_2_2 and make the changes, then use volumes to overwrite it.

volumes:
  - /dev/mycode/magento_2_2/app/code/Magento/Catalog/Block/Product/Price.php:/var/www/html/app/code/Magento/Catalog/Block/Product/Price.php

By using Docker, we can make sure that all your changes to Magento core files are kept in one place and tracked in source code repository. These changes are also correctly aligned with different Magento versions.

When deploying those changes to production servers, we can simply copy all files in the /dev/mycode/magento_2_2 directory to Magento installation directory and overwrite existing files.

Test Magento compatibilities

This Docker images has different tags for corresponding Magento 2.4 versions. You can switch to different Magento versions very easily when testing extensions and themes.

docker-magento2's People

Contributors

alexcheng1982 avatar rennefeld 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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

docker-magento2's Issues

Fail to install extension from Marketplace

I have found that attempting to install any extension from the marketplace via the GUI fails the Readiness check at the Checking Component Dependency stage.

This is caused by PHP memory_limit being set in the .htaccess to 756M which is too low 2G is recommended.

I have had to sed my .htaccess to fix this issue.

Magento Marketplace Extension Not Appearing

Hi guys :)

Great Image worked like a charm so far.
But I purchased an extension Magento Market place
Then logged in with private and public key as normal.
But I can't see my purchased extension for Magento 2.3.x
I tried from Magento 2.3. and 2.3.1 both say -> "You have purchased no extensions"
Screenshot_9
Screenshot_10

What shall I do ? Marketplace Support just sent me some standard message to post on the forums... which I did, but no response yet? Any idea?

Mount Volumes with Docker on Windows 10 Client

I`m new with Docker, maybe somebody can help.
I can not mount my /var/www/html folder to C:/Docker/magento2/m4y on my windows 10 client.

Thanks for any help.

My docker-compose.yml

version: '3.0'
services:
web:
image: alexcheng/magento2
ports:
- "80:80"
links:
- db
env_file:
- env
volumes:
- magento-data:/var/www/html
- C:/Docker/magento2/m4y:/var/www/html/app/code
db:
image: mysql:5.6.23
volumes:
- db-data:/var/lib/mysql/data
env_file:
- env
phpmyadmin:
image: phpmyadmin/phpmyadmin
ports:
- "8580:80"
links:
- db
volumes:
db-data:
magento-data:

windows
docker
docker-settings

Error in final step: install-sampledata

I am using docker on Win10 Pro (which works without Problems) and wanted to install your Magento2 Containers (Version 2.2.2). I downloaded the git and followed the instructions.
Everything works well until the final step:

Here are the last lines on my command prompt:
....

  • Installing magento/module-sales-sample-data (100.2.1): Downloading (100%)
    Package sjparkinson/static-review is abandoned, you should avoid using it. Use phpro/grumphp instead.
    Writing lock file
    Generating autoload files

Fatal error: Uncaught Error: Class 'Symfony\Polyfill\Php72\Php72' not found in /var/www/html/vendor/symfony/polyfill-php72/bootstrap.php:29
Stack trace:
#0 /var/www/html/vendor/composer/autoload_real.php(70): require()
#1 /var/www/html/vendor/composer/autoload_real.php(60): composerRequire8c2811ee3eb8dbe884f05970a3bc19a1('25072dd6e247008...', '/var/www/html/v...')
#2 /var/www/html/vendor/autoload.php(7): ComposerAutoloaderInit8c2811ee3eb8dbe884f05970a3bc19a1::getLoader()
#3 /var/www/html/app/autoload.php(30): include('/var/www/html/v...')
#4 /var/www/html/app/bootstrap.php(30): require_once('/var/www/html/a...')
#5 /var/www/html/bin/magento(14): require('/var/www/html/a...')
#6 {main}
thrown in /var/www/html/vendor/symfony/polyfill-php72/bootstrap.php on line 29

Fatal error: Uncaught Error: Class 'Symfony\Polyfill\Php72\Php72' not found in /var/www/html/vendor/symfony/polyfill-php72/bootstrap.php:29
Stack trace:
#0 /var/www/html/vendor/composer/autoload_real.php(70): require()
#1 /var/www/html/vendor/composer/autoload_real.php(60): composerRequire8c2811ee3eb8dbe884f05970a3bc19a1('25072dd6e247008...', '/var/www/html/v...')
#2 /var/www/html/vendor/autoload.php(7): ComposerAutoloaderInit8c2811ee3eb8dbe884f05970a3bc19a1::getLoader()
#3 /var/www/html/app/autoload.php(30): include('/var/www/html/v...')
#4 /var/www/html/app/bootstrap.php(30): require_once('/var/www/html/a...')
#5 /var/www/html/bin/magento(14): require('/var/www/html/a...')
#6 {main}
thrown in /var/www/html/vendor/symfony/polyfill-php72/bootstrap.php on line 29

What do I wrong? Should I test your older versions??

Thanks!
PAscal

Error when installing sample data

docker exec -it magento2_web_1 install-sampledata

./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - The requested package magento/module-review-sample-data could not be found in any version, there may be a typo in the package name.
  Problem 2
    - The requested package magento/module-sales-sample-data could not be found in any version, there may be a typo in the package name.
  Problem 3
    - The requested package magento/module-sales-rule-sample-data could not be found in any version, there may be a typo in the package name.
  Problem 4
    - The requested package magento/sample-data-media could not be found in any version, there may be a typo in the package name.
  Problem 5
    - The requested package magento/module-swatches-sample-data could not be found in any version, there may be a typo in the package name.
  Problem 6
    - The requested package magento/module-tax-sample-data could not be found in any version, there may be a typo in the package name.
  Problem 7
    - The requested package magento/module-theme-sample-data could not be found in any version, there may be a typo in the package name.
  Problem 8
    - The requested package magento/module-widget-sample-data could not be found in any version, there may be a typo in the package name.
  Problem 9
    - The requested package magento/module-wishlist-sample-data could not be found in any version, there may be a typo in the package name.
  Problem 10
    - The requested package magento/module-bundle-sample-data could not be found in any version, there may be a typo in the package name.
  Problem 11
    - The requested package magento/module-catalog-sample-data could not be found in any version, there may be a typo in the package name.
  Problem 12
    - The requested package magento/module-catalog-rule-sample-data could not be found in any version, there may be a typo in the package name.
  Problem 13
    - The requested package magento/module-cms-sample-data could not be found in any version, there may be a typo in the package name.
  Problem 14
    - The requested package magento/module-configurable-sample-data could not be found in any version, there may be a typo in the package name.
  Problem 15
    - The requested package magento/module-product-links-sample-data could not be found in any version, there may be a typo in the package name.
  Problem 16
    - The requested package magento/module-customer-sample-data could not be found in any version, there may be a typo in the package name.
  Problem 17
    - The requested package magento/module-downloadable-sample-data could not be found in any version, there may be a typo in the package name.
  Problem 18
    - The requested package magento/module-grouped-product-sample-data could not be found in any version, there may be a typo in the package name.
  Problem 19
    - The requested package magento/module-msrp-sample-data could not be found in any version, there may be a typo in the package name.
  Problem 20
    - The requested package magento/module-offline-shipping-sample-data could not be found in any version, there may be a typo in the package name.

Potential causes:
 - A typo in the package name
 - The package is not available in a stable-enough version according to your minimum-stability setting
   see <https://getcomposer.org/doc/04-schema.md#minimum-stability> for more details.

Read <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.

Installation failed, reverting ./composer.json to its original content.
There is an error during sample data deployment. Composer file will be reverted.

  [Magento\Setup\Exception]
  Can't run this operation: deployment configuration is absent. Run 'magento setup:config:set --help' for options.

setup:upgrade [--keep-generated] [--magento-init-params="..."]

docker-compose up -d fails with errors in crontab file

Running docker-compose up -d eventually fails with this error:

Step 28/28 : RUN chmod 0644 /etc/cron.d/magento2-cron     && crontab -u www-data /etc/cron.d/magento2-cron
 ---> Running in fbdd496e3d53
"/etc/cron.d/magento2-cron":2: bad minute
errors in crontab file, can't install.
ERROR: Service 'web' failed to build: The command '/bin/sh -c chmod 0644 /etc/cron.d/magento2-cron     && crontab -u www-data /etc/cron.d/magento2-cron' returned a non-zero code: 1

Version

  • Output of docker version:
Client: Docker Engine - Community
 Version:           19.03.1
 API version:       1.40
 Go version:        go1.12.5
 Git commit:        74b1e89
 Built:             Thu Jul 25 21:17:08 2019
 OS/Arch:           windows/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          19.03.1
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.12.5
  Git commit:       74b1e89
  Built:            Thu Jul 25 21:17:52 2019
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v1.2.6
  GitCommit:        894b81a4b802e4eb2a91d1ce216b8817763c29fb
 runc:
  Version:          1.0.0-rc8
  GitCommit:        425e105d5a03fabd737a126ad93d62a9eeede87f
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683
  • Output of docker info:
Client:
 Debug Mode: false

Server:
 Containers: 6
  Running: 3
  Paused: 0
  Stopped: 3
 Images: 8
 Server Version: 19.03.1
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 894b81a4b802e4eb2a91d1ce216b8817763c29fb
 runc version: 425e105d5a03fabd737a126ad93d62a9eeede87f
 init version: fec3683
 Security Options:
  seccomp
   Profile: default
 Kernel Version: 4.9.184-linuxkit
 Operating System: Docker Desktop
 OSType: linux
 Architecture: x86_64
 CPUs: 4
 Total Memory: 6.064GiB
 Name: docker-desktop
 ID: NJTM:5WFU:VTOA:I67C:7BQS:E3I3:TGSU:DVIO:C2EO:RKGA:RG53:E5ET
 Docker Root Dir: /var/lib/docker
 Debug Mode: true
  File Descriptors: 76
  Goroutines: 98
  System Time: 2019-08-12T15:39:09.8028854Z
  EventsListeners: 1
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false
 Product License: Community Engine
  • Output of docker-compose version:
docker-compose version 1.24.1, build 4667896b
docker-py version: 3.7.3
CPython version: 3.6.8
OpenSSL version: OpenSSL 1.0.2q  20 Nov 2018

Upgrade to Enterprise Edition

I am trying to upgrade to Magento 2 EE after installing Magento 2.3.1 CE using this Image. But there is no luck yet. What I did is:

  1. Updated access keys in auth.json with Enterprise edition access keys.
  2. Updated composer.json (Changed name, type, license and "require")
{
    "name": "magento/product-enterprise-edition",
    "description": "eCommerce Platform for Growth (Enterprise Edition)",
    "type": "metapakage",
    "license": [
    "Proprietary"
    ],
    "config": {
    "preferred-install": "dist",
    "sort-packages": true
    },
    "require": {
    "magento/product-enterprise-edition": "2.3.1"
    },
..........................
..........................
}

and executed:

composer update

but it removed many dependencies. I also tried upgrade from Magento Backend, as described here [https://devdocs.magento.com/guides/v2.3/comp-mgr/upgrader/ce-ee-upgrade-start.html]
but it says 'you are already using latest version'. Where is problem ?

Where is the data...?

I installed, I can access phpmyadmin and the db is there etc, but where is the code base?

$ sudo ls /var/www
ls: cannot access '/var/www': No such file or directory

My docker-compose.yml:

services:
  web:
    image: alexcheng/magento2
    ports:
      - "80:80"
    links:
      - db
    env_file:
      - env
    volumes:
      - /home/magento-data:/var/www/html
  db:
    image: mysql:5.6.23
    volumes:
      - db-data:/var/lib/mysql/data
    env_file:
      - env
  phpmyadmin:
    image: phpmyadmin/phpmyadmin
    ports:
      - "8580:80"
    links:
      - db
volumes:
  db-data:
  magento-data:

$ sudo ls /home/magento-data/

empty

Module Development

Hi there, how can I create a volume to Module development?

For example, using Docker's wordpress I can add at docker-compose.yml:

volumes:
       - ./plugins:/var/www/html/wp-content/plugins

And every plugin added to Wordpress will be accessible from plugins folder.

Do you know any way to do this in Magento2 using your Docker image?

Database access denied

Hi Alex!

I changed the configurations on env file, but when i execute the command "docker exec", i receive the message "Access denied for user 'magento'@'dockermagento2_web_1.dockermagento2_default' (using password: YES)".

I am a newbie on docker universe, and the solution can be simple, but i can't see this solution.

Best regards!

docker magento2 web not work

after run docker-compose up -d
the DB and PhpMyAdmin they work well, but docker-magento2_web give me this error

ERROR: for web Cannot start service web: driver failed programming external connectivity on endpoint docker-magento2_web_1 (02428fb685857fc6b54ee0e20d87ded058c3fc86246bc3181cb5fcd0af127e75): Error starting userland proxy: Bind for 0.0.0.0:80: unexpected error (Failure EADDRINUSE) ERROR: Encountered errors while bringing up the project.

docker-compose -v
docker-compose version 1.23.2, build 1110ad01

docker -v
Docker version 18.09.2, build 6247962

Change PHP7.1.11 to PHP7.0?

How can i change the command lines PHP Version to 7.0?

apt-get install php7.0
update-alternatives --set php /usr/bin/php7.0
php -v
PHP 7.1.11 (cli) (built: Nov 22 2017 11:01:27) ( NTS ) Copyright (c) 1997-2017 The PHP Group Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies

User issues on Mac

Hi, I am trying to run this image on a mac, but it keeps saying that it does not find the users:

On docker-compose up:
web_1 | *** Running /etc/my_init.d/00_regen_ssh_host_keys.sh...
web_1 | *** Running /etc/rc.local...
web_1 | *** Booting runit daemon...
web_1 | *** Runit started as PID 7
web_1 | chown: invalid user: ‘root:adm’
web_1 | AH00543: apache2: bad user name www-data
web_1 | Error resolving user; user='root'
web_1 | AH00543: apache2: bad user name www-data
web_1 | May 30 18:59:39 b5b073c76415 syslog-ng[21]: syslog-ng starting up; version='3.5.6'
web_1 | AH00543: apache2: bad user name www-data

When I trie to run install-magento it shows:
su: Cannot determine your user name.

I think I have to create these users, but why they are not created on mac?
Should I add on Docker code?

Update Catalog search to using Elasticsearch

After launching a new container with version 2.3.0, the following notification appears:

Catalog Search is currently configured to use the MySQL engine, which has been deprecated. Consider migrating to one of the Elasticsearch engines now to ensure there are no service interruptions during your next upgrade.

This issue is a feature request to upgrade the image to using Elasticsearch.

Cannot access sample ap on Win

Hello Alex,
I use Docker Toolbox on Win7. After installing completely, i guess, I can access phpmyadmin. However, the browser displayes error message that "can’t establish a connection to the server at local.magento" when I try to access sample app via either 127.0.0.1 or http://local.magento. I have configured the host file already.
Please help me to solve it.

configuring https for magento

Hello,

I successfully installed magento2 with docker but was unable to setup https://local.magento.
I tried to expose and publish port 443 with in the yml file:

version: '3.0'
services:
  web:
    image: alexcheng/magento2
    expose: 
      - "443"
    ports:
      - "80:80"
      - "443:444"
    links:
      - db
    env_file:
      - env
  db:
    image: mysql:5.6.23
    volumes:
      - db-data:/var/lib/mysql/data
    env_file:
      - env
  phpmyadmin:
    image: phpmyadmin/phpmyadmin
    ports:
      - "8580:80"
    links:
      - db     
volumes:
  db-data: 

hoever, without any success. During installation, I choose https for storefront.
Any ideas?

Thanks a lot in advance

Incorrect permissions

After running php bin/magento setup:upgrade to upgrade the database, I'm left with:

Fatal error: Uncaught RuntimeException: Can't create directory /var/www/html/generated/code/Magento/Framework/App/ResourceConnection/. in [Magento\Framework\App\ResourceConnection\Proxy] in /var/www/html/vendor/magento/framework/Code/Generator.php:115 Stack trace: #0 /var/www/html/vendor/magento/framework/Code/Generator/Autoloader.php(35): Magento\Framework\Code\Generator->generateClass('Magento\\Framewo...') #1 [internal function]: Magento\Framework\Code\Generator\Autoloader->load('Magento\\Framewo...') #2 [internal function]: spl_autoload_call('Magento\\Framewo...') #3 /var/www/html/vendor/magento/framework/Code/Reader/ClassReader.php(19): ReflectionClass->__construct('Magento\\Framewo...') #4 /var/www/html/vendor/magento/framework/ObjectManager/Definition/Runtime.php(44): Magento\Framework\Code\Reader\ClassReader->getConstructor('Magento\\Framewo...') #5 /var/www/html/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(48): Magento\Framework\ObjectManager\Definition\Runtime->getParameters('Magento\\Fra in /var/www/html/vendor/magento/framework/Code/Generator.php on line 115

Since the whole Magento is within the container I assume that this could and should be adjusted more globally.

ERROR: unauthorized: authentication required

Hi, i'm trying to use this docker container but when i execute docker-compose up the process stop with the message "ERROR: unauthorized: authentication required".

I tried doing "docker ligin" before, but nothing changes...

Any idea?

Here is my output

diegosana@diegosana-asus:/var/www/docker-magento2$ sudo docker-compose up
Pulling web (alexcheng/magento2:)...
latest: Pulling from alexcheng/magento2
22ecafbbcc4a: Pulling fs layer
580435e0a086: Pulling fs layer
8321ffd10031: Pull complete
08b8f28a13c2: Pull complete
2b401702069a: Pull complete
a3ed95caeb02: Pull complete
eae027dcdc0e: Pull complete
93bc98227159: Pull complete
111507accabd: Extracting [=================================> ] 47.91MB/70.71MB
2c0cb4d4ff4b: Download complete
3d284241ebf0: Download complete
0631fc482409: Download complete
286675156b85: Download complete
e5b6994c902a: Download complete
917eecc363d9: Download complete
d5faf4a2aeab: Download complete
c10bcc101b68: Downloading [===================> ] 21.45MB/55.4MB
15141f14a6f8: Download complete
3833d5cc744b: Download complete
442d6522974a: Download complete
cf1f8b38c887: Download complete
64c01220fa1d: Download complete
9faa220a0ac9: Download complete
5dec6de87f87: Download complete
65fc63c4bf16: Download complete
2fe0bf297022: Downloading [============> ] 9.796MB/40.06MB
408d745ef075: Download complete
4c33701a058f: Downloading
0f0ce5ff2f50: Waiting
3cc262ad41b7: Waiting
d400c395ba15: Waiting
21c13ea0f372: Waiting
843aba302d16: Waiting
0861754c3159: Waiting
012244a709cc: Waiting
1343385cb57e: Waiting
6e8e0881c527: Waiting
19bd345e8b51: Waiting
6985e0932b80: Waiting
ERROR: unauthorized: authentication required

Custom Theme

I have a volume in my docker compose like this:
- /dev/mytheme:/var/www/html/app/design/frontend/mytheme/default
then in my local directory in the dev/mytheme folder I have the registration.php file to register a custom theme but when I go to the local admin area I am not seeing the custom theme. Have I missed a step?

Could you help.
Thanks

PHP error on category and search page

Hi, we have an strange issue with M 2.2.5 and 2.2.6. Whole magento works but when rendering Category or Search page (probably pages with product list), we're getting this error. Trying to fix it for two days, no luck, tried so much things found on net...

Fatal error: Uncaught Error: Cannot instantiate interface Magento\Framework\Search\Request\IndexScopeResolverInterface in /var/www/html/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:50 Stack trace: #0 /var/www/html/vendor/magento/framework/ObjectManager/ObjectManager.php(70): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create('Magento\\Framewo...') #1 /var/www/html/vendor/magento/module-catalog-search/Model/Search/FilterMapper/ExclusionStrategy.php(90): Magento\Framework\ObjectManager\ObjectManager->get('Magento\\Framewo...') #2 /var/www/html/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(111): Magento\CatalogSearch\Model\Search\FilterMapper\ExclusionStrategy->__construct(Object(Magento\Framework\App\ResourceConnection\Interceptor), Object(Magento\Store\Model\StoreManager), Object(Magento\CatalogSearch\Model\Adapter\Mysql\Filter\AliasResolver), NULL, NULL, Object(Magento\Catalog\Model\Indexer\Product\Price\PriceTableResolver), NULL) #3 /var/www/html/vendor/magento/ in /var/www/html/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php on line 50

Invalid backend frontname

When trying to install magento via script I get:

Invalid backend frontname ''

In InstallCommand.php line 264:

Parameter validation failed

setup:install [--backend-frontname BACKEND-FRONTNAME] [--amqp-host AMQP-HOST] ....

Installing via web is ok.

Clearing cache

When I go to the cache management I see full page cache is not up to date , when I then clear the cache the docker breaks down.

HELP: I'm stuck in add database

Sorry for this question, but I'm a new using docker and magento

I can't/ I don't know how to connect magento with database, in the second step.

I have mysql in local but what should I add in server hostname ?

also I try to install mysql server container and also I don't know what is the host name should added

any help ?

Unable to see sample application

I have followed the steps as mention on Mac 10.13.3.

When I run docker-compose up -d I get following
Starting dockermagento2_db_1 ... done
Starting dockermagento2_web_1 ...
Starting dockermagento2_web_1 ... done

My host file has an entry as below:
local.magento localhost

I am able to see sample data in db but when I try to access local.magento in safari I get Safari cannot find the server local.magento.

Any help will be much appreciated.

Unable to Install "Parameter validation failed"

I have edited the MYSQL_HOST variable of env file with IP given by:

sudo docker inspect <image-name-of-magento> | grep IPAddress

When I connect the DB with the above IP as:

mysql -h <ip-from-above> -u root -p

It works fine.

But when I try to install Magento with command:

sudo docker exec -it <mage-container> install-magento

It gives the error

SQLSTATE[HY000] [2002] No such file or directory
In InstallCommand.php line 264:
Parameter validation failed
setup:install [--backend-frontname BACKEND-FRONTNAME] [--amqp-host AMQP-HOST] [--amqp-port AMQP-PORT] [--amqp-user AMQP-USER] [--amqp-password AMQP-PASSWORD] [--amqp-virtualhost AMQP-VIRTUALHOST] [--amqp-ssl AMQP-SSL] [--amqp-ssl-options AMQP-SSL-OPTIONS] [--key KEY] [--db-host DB-HOST] [--db-name DB-NAME] [--db-user DB-USER] [--db-engine DB-ENGINE] [--db-password DB-PASSWORD] [--db-prefix DB-PREFIX] [--db-model DB-MODEL] [--db-init-statements DB-INIT-STATEMENTS] [-s|--skip-db-validation] [--http-cache-hosts HTTP-CACHE-HOSTS] [--session-save SESSION-SAVE] [--session-save-redis-host SESSION-SAVE-REDIS-HOST] [--session-save-redis-port SESSION-SAVE-REDIS-PORT] [--session-save-redis-password SESSION-SAVE-REDIS-PASSWORD] [--session-save-redis-timeout SESSION-SAVE-REDIS-TIMEOUT] [--session-save-redis-persistent-id SESSION-SAVE-REDIS-PERSISTENT-ID] [--session-save-redis-db SESSION-SAVE-REDIS-DB] [--session-save-redis-compression-threshold SESSION-SAVE-REDIS-COMPRESSION-THRESHOLD] [--session-save-redis-compression-lib SESSION-SAVE-REDIS-COMPRESSION-LIB] [--session-save-redis-log-level SESSION-SAVE-REDIS-LOG-LEVEL] [--session-save-redis-max-concurrency SESSION-SAVE-REDIS-MAX-CONCURRENCY] [--session-save-redis-break-after-frontend SESSION-SAVE-REDIS-BREAK-AFTER-FRONTEND] [--session-save-redis-break-after-adminhtml SESSION-SAVE-REDIS-BREAK-AFTER-ADMINHTML] [--session-save-redis-first-lifetime SESSION-SAVE-REDIS-FIRST-LIFETIME] [--session-save-redis-bot-first-lifetime SESSION-SAVE-REDIS-BOT-FIRST-LIFETIME] [--session-save-redis-bot-lifetime SESSION-SAVE-REDIS-BOT-LIFETIME] [--session-save-redis-disable-locking SESSION-SAVE-REDIS-DISABLE-LOCKING] [--session-save-redis-min-lifetime SESSION-SAVE-REDIS-MIN-LIFETIME] [--session-save-redis-max-lifetime SESSION-SAVE-REDIS-MAX-LIFETIME] [--session-save-redis-sentinel-master SESSION-SAVE-REDIS-SENTINEL-MASTER] [--session-save-redis-sentinel-servers SESSION-SAVE-REDIS-SENTINEL-SERVERS] [--session-save-redis-sentinel-verify-master SESSION-SAVE-REDIS-SENTINEL-VERIFY-MASTER] [--session-save-redis-sentinel-connect-retires SESSION-SAVE-REDIS-SENTINEL-CONNECT-RETIRES] [--cache-backend CACHE-BACKEND] [--cache-backend-redis-server CACHE-BACKEND-REDIS-SERVER] [--cache-backend-redis-db CACHE-BACKEND-REDIS-DB] [--cache-backend-redis-port CACHE-BACKEND-REDIS-PORT] [--cache-backend-redis-password CACHE-BACKEND-REDIS-PASSWORD] [--page-cache PAGE-CACHE] [--page-cache-redis-server PAGE-CACHE-REDIS-SERVER] [--page-cache-redis-db PAGE-CACHE-REDIS-DB] [--page-cache-redis-port PAGE-CACHE-REDIS-PORT] [--page-cache-redis-compress-data PAGE-CACHE-REDIS-COMPRESS-DATA] [--page-cache-redis-password PAGE-CACHE-REDIS-PASSWORD] [--base-url BASE-URL] [--language LANGUAGE] [--timezone TIMEZONE] [--currency CURRENCY] [--use-rewrites USE-REWRITES] [--use-secure USE-SECURE] [--base-url-secure BASE-URL-SECURE] [--use-secure-admin USE-SECURE-ADMIN] [--admin-use-security-key ADMIN-USE-SECURITY-KEY] [--admin-user [ADMIN-USER]] [--admin-password [ADMIN-PASSWORD]] [--admin-email [ADMIN-EMAIL]] [--admin-firstname [ADMIN-FIRSTNAME]] [--admin-lastname [ADMIN-LASTNAME]] [--cleanup-database] [--sales-order-increment-prefix SALES-ORDER-INCREMENT-PREFIX] [--use-sample-data] [--enable-modules [ENABLE-MODULES]] [--disable-modules [DISABLE-MODULES]] [--convert-old-scripts [CONVERT-OLD-SCRIPTS]] [-i|--interactive] [--safe-mode [SAFE-MODE]] [--data-restore [DATA-RESTORE]] [--dry-run [DRY-RUN]] [--magento-init-params MAGENTO-INIT-PARAMS]

Wrong PhpMyAdmin port in README.md

Wrong PhpMyAdmin port in README.md.

docker-compose.yml

phpmyadmin:
    image: phpmyadmin/phpmyadmin
    ports:
      - "8580:80"

README.md

### Database

...
The default URL for phpMyAdmin is `http://localhost:8085`. 
Use MySQL username and password to log in.
...

RabbitMQ

How can we get up and running with RabbitMQ? Do we have to edit the "install-magento" file and rerun the installation?

Can someone point me to the right direction?

Thanks!

How can I run the update.js

Hi everyone.

If I want to clone this repo.. how can I run update.js to generate developer and integrator folder?

I understand that I need to have nodejs and install package.json.. but after that what else I need to run.??

tnks to all.

Data not persistent after container restart

There should be a directory on host mounted on /var/www/html of container where the code resides persistently and should not be deleted when container is restarted.

something like:
volumes:
-./code:/var/www/html

Documentation request

I forked the repo,then i cloned to my local,then I checkout to 2.1 branch by fetching the original repo.
I renamed to docker-compose.yml .
Now i ran docker-compose up -d .
Now what are the steps needed to run the magento in host browser?
Can you add documentation?

Unable to install extension from folder by providing it as a volume

Following the instructions in the README, I'm trying to add my extension as a volume (the folders show up successfully), however, my extension is not detected.

    volumes:
      - /magento-plugin:/var/www/html/app/code/MY_EXTENSION
      - /magento-plugin:/var/www/html/app/code/MY_EXTENSION
      - /magento-plugin:/var/www/html/vendor/magento/module-MY_EXTENSION
      - /magento-plugin:/var/www/html/vendor/MY_EXTENSION/aristanedr
      - /magento-plugin:/var/www/html/vendor/MY_EXTENSION

Very slow troubleshooting

Magento is running very slowly on my machine, but my colleague (who has different hardware but the same docker configuration) has no problems at all. My machine takes up to 10 seconds to load the home page where theirs takes less than a second. Any ideas on how to troubleshoot this?

Both machines are Windows 10 with quad core i7 processor and 8Gbs of RAM.

`docker-compose web install-magento` broken

docker-compose up -d
docker-compose web install-magento

                                                          
  [Symfony\Component\Console\Exception\RuntimeException]  
  The "--db-name" option requires a value.                
                                                          

setup:install [--backend-frontname BACKEND-FRONTNAME] [--key KEY] [--db-host DB-HOST] [--db-name DB-NAME] [--db-user DB-USER] [--db-engine DB-ENGINE] [--db-password DB-PASSWORD] [--db-prefix DB-PREFIX] [--db-model DB-MODEL] [--db-init-statements DB-INIT-STATEMENTS] [-s|--skip-db-validation] [--http-cache-hosts HTTP-CACHE-HOSTS] [--session-save SESSION-SAVE] [--session-save-redis-host SESSION-SAVE-REDIS-HOST] [--session-save-redis-port SESSION-SAVE-REDIS-PORT] [--session-save-redis-password SESSION-SAVE-REDIS-PASSWORD] [--session-save-redis-timeout SESSION-SAVE-REDIS-TIMEOUT] [--session-save-redis-persistent-id SESSION-SAVE-REDIS-PERSISTENT-ID] [--session-save-redis-db SESSION-SAVE-REDIS-DB] [--session-save-redis-compression-threshold SESSION-SAVE-REDIS-COMPRESSION-THRESHOLD] [--session-save-redis-compression-lib SESSION-SAVE-REDIS-COMPRESSION-LIB] [--session-save-redis-log-level SESSION-SAVE-REDIS-LOG-LEVEL] [--session-save-redis-max-concurrency SESSION-SAVE-REDIS-MAX-CONCURRENCY] [--session-save-redis-break-after-frontend SESSION-SAVE-REDIS-BREAK-AFTER-FRONTEND] [--session-save-redis-break-after-adminhtml SESSION-SAVE-REDIS-BREAK-AFTER-ADMINHTML] [--session-save-redis-first-lifetime SESSION-SAVE-REDIS-FIRST-LIFETIME] [--session-save-redis-bot-first-lifetime SESSION-SAVE-REDIS-BOT-FIRST-LIFETIME] [--session-save-redis-bot-lifetime SESSION-SAVE-REDIS-BOT-LIFETIME] [--session-save-redis-disable-locking SESSION-SAVE-REDIS-DISABLE-LOCKING] [--session-save-redis-min-lifetime SESSION-SAVE-REDIS-MIN-LIFETIME] [--session-save-redis-max-lifetime SESSION-SAVE-REDIS-MAX-LIFETIME] [--cache-backend CACHE-BACKEND] [--cache-backend-redis-server CACHE-BACKEND-REDIS-SERVER] [--cache-backend-redis-db CACHE-BACKEND-REDIS-DB] [--cache-backend-redis-port CACHE-BACKEND-REDIS-PORT] [--page-cache PAGE-CACHE] [--page-cache-redis-server PAGE-CACHE-REDIS-SERVER] [--page-cache-redis-db PAGE-CACHE-REDIS-DB] [--page-cache-redis-port PAGE-CACHE-REDIS-PORT] [--page-cache-redis-compress-data PAGE-CACHE-REDIS-COMPRESS-DATA] [--base-url BASE-URL] [--language LANGUAGE] [--timezone TIMEZONE] [--currency CURRENCY] [--use-rewrites USE-REWRITES] [--use-secure USE-SECURE] [--base-url-secure BASE-URL-SECURE] [--use-secure-admin USE-SECURE-ADMIN] [--admin-use-security-key ADMIN-USE-SECURITY-KEY] [--admin-user ADMIN-USER] [--admin-password ADMIN-PASSWORD] [--admin-email ADMIN-EMAIL] [--admin-firstname ADMIN-FIRSTNAME] [--admin-lastname ADMIN-LASTNAME] [--cleanup-database] [--sales-order-increment-prefix SALES-ORDER-INCREMENT-PREFIX] [--use-sample-data] [-i|--interactive] [--magento-init-params MAGENTO-INIT-PARAMS]

Magento broken when running bin/magento setup:upgrade

I have followed your instructions correctly, and everything installs perfectly. Magento runs as expected.

I then run bin/magento setup:upgrade and magento blows up and needs to be re-installed.
The error I get in my browser is:

Fatal error: Uncaught RuntimeException: Can't create directory /var/www/html/generated/code/Magento/Framework/App/ResourceConnection/. Class Magento\Framework\App\ResourceConnection\Proxy generation error: The requested class did not generate properly, because the 'generated' directory permission is read-only. If --- after running the 'bin/magento setup:di:compile' CLI command when the 'generated' directory permission is set to write --- the requested class did not generate properly, then you must add the generated class object to the signature of the related construct method, only. in /var/www/html/vendor/magento/framework/Code/Generator.php:135 Stack trace: #0 /var/www/html/vendor/magento/framework/Code/Generator/Autoloader.php(35): Magento\Framework\Code\Generator->generateClass('Magento\\Framewo...') #1 [internal function]: Magento\Framework\Code\Generator\Autoloader->load('Magento\\Framewo...') #2 [internal function]: spl_autoload_call('Magento\\Framewo...') #3 /var/www/html/vendor/magento/framework/Code/Reader/Class in /var/www/html/vendor/magento/framework/Code/Generator.php on line 135

can't run dockermagento2_db_1 container

if i make a simple docker-compose up -d
it looks fine like
Creating dockermagento2_db_1 ... Creating dockermagento2_db_1 ... done Creating dockermagento2_phpmyadmin_1 ... Creating dockermagento2_web_1 ... Creating dockermagento2_web_1 Creating dockermagento2_web_1 ... done

But if i try docker ps ... i see that web1 and phpmyadmin is running but the mysql container not.
I got a Exited (139) 22 seconds ago

And they are no logs no error .... trying docker logs dockermagento2_db_1

Docker version 18.03.1-ce, build 9ee9f40
4.15.0-kali3-amd64 #1 SMP Debian 4.15.17-1kali1 (2018-04-25) x86_64 GNU/Linux

Install sample data failed on MAC

MAC,
docker Version 18.03.1-ce-mac65 (24312)
Compose: 1.21.1
Machine: 0.14.0

Refer your guide, execute the following query:
$docker exec -it docker-magento2_web_1 install-sampledata

ln: failed to create symbolic link '/var/www/html/var/composer_home/auth.json': File exists
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)

But after 20min, it's still stop here...
After review other issues, still cannot resolve this problem.

@alexcheng1982 If you have time, could you help me?

CDN External images not working

I am having problems serving images from a CDN.

Steps to reproduce (with standard installation):

docker-compose up -d
$ docker exec -it <container_name> install-magento
set CDN under: stores > configuration > web > Base URL for User Media Files > http://example.com/
import a simple product with a sample image: s01.jpg (only the file name of the jpg), with the assumption that the cdn has the images in the root of the site.

the database shows: /s//s01.jpg (notice the extra /s//)
the product page shows: http://example.com/pub/media/catalog/product/cache/f073062f50e48eb0f0998593e568d857/s/_/s01.jpg

I expected product page to show: http://example.com/s01.jpg

Slow

My Magento2 is very slow. There's anything that I can do to improve the performance?

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.