- This topic is empty.
-
AuthorPosts
-
May 23, 2023 at 8:07 am #9891inked_rabbitParticipant
I need to be able to locally develop on Magento 2 (Adobe Commerce) using Docker. I am able to spin up an instance of Magento 2 using the following steps:
-
In the terminal, run the following command:
curl -k https://raw.githubusercontent.com/bitnami/containers/main/bitnami/magento/docker-compose.yml > docker-compose.yml
-
In the terminal, run the following command:
docker-compose up -d
This will start the process of brining in the necessary files to run Magento 2. -
In your browser, enter in “localhost:80â€
Below is the docker-compose.yml file that I am using:
==================================================
version: '2' services: mariadb: image: docker.io/bitnami/mariadb:10.4 environment: # ALLOW_EMPTY_PASSWORD is recommended only for development. - ALLOW_EMPTY_PASSWORD=yes - MARIADB_USER=bn_magento - MARIADB_DATABASE=bitnami_magento volumes: - 'mariadb_data:/bitnami/mariadb' magento: image: docker.io/bitnami/magento:2 ports: - '80:8080' - '443:8443' environment: - MAGENTO_HOST=localhost - MAGENTO_DATABASE_HOST=mariadb - MAGENTO_DATABASE_PORT_NUMBER=3306 - MAGENTO_DATABASE_USER=bn_magento - MAGENTO_DATABASE_NAME=bitnami_magento - ELASTICSEARCH_HOST=elasticsearch - ELASTICSEARCH_PORT_NUMBER=9200 # ALLOW_EMPTY_PASSWORD is recommended only for development. - ALLOW_EMPTY_PASSWORD=yes volumes: - 'magento_data:/bitnami/magento' depends_on: - mariadb - elasticsearch elasticsearch: image: docker.io/bitnami/elasticsearch:7 volumes: - 'elasticsearch_data:/bitnami/elasticsearch/data' volumes: mariadb_data: driver: local magento_data: driver: local elasticsearch_data: driver: local
======================================================
This gets me my local instance of Magento 2. However, I can’t work with the files as they are not being included into the folder where I have the docker-compose.yml file. I know it has something to do with a bind-mount but I can’t figure out how to go about it.
I’ve been working on this for weeks and just haven’t found the finishing touch.
I tried finding a docker-compose.yml file that has the proper configuration to bring in the Magento 2 files into my working directory but I haven’t found anything and any attempts I’ve had at writing in my own bind-mounts to the docker-compose.yml file have not worked.
May 25, 2023 at 5:52 am #9892byalexesParticipantAttention, before performing these actions, please save your changes so that you can later copy them to the Magento 2 files folder.
To make Magento 2 files visible, you need to change the path to the ‘magento_data’ folder to:
volumes: - './magento_data:/bitnami/magento'
To do this, please edit the ‘docker-compose.yml’ file
version: '2' services: mariadb: image: docker.io/bitnami/mariadb:10.4 environment: # ALLOW_EMPTY_PASSWORD is recommended only for development. - ALLOW_EMPTY_PASSWORD=yes - MARIADB_USER=bn_magento - MARIADB_DATABASE=bitnami_magento volumes: - 'mariadb_data:/bitnami/mariadb' magento: image: docker.io/bitnami/magento:2 ports: - '80:8080' - '443:8443' environment: - MAGENTO_HOST=localhost - MAGENTO_DATABASE_HOST=mariadb - MAGENTO_DATABASE_PORT_NUMBER=3306 - MAGENTO_DATABASE_USER=bn_magento - MAGENTO_DATABASE_NAME=bitnami_magento - ELASTICSEARCH_HOST=elasticsearch - ELASTICSEARCH_PORT_NUMBER=9200 # ALLOW_EMPTY_PASSWORD is recommended only for development. - ALLOW_EMPTY_PASSWORD=yes volumes: - './magento_data:/bitnami/magento' depends_on: - mariadb - elasticsearch elasticsearch: image: docker.io/bitnami/elasticsearch:7 volumes: - 'elasticsearch_data:/bitnami/elasticsearch/data' volumes: mariadb_data: driver: local magento_data: driver: local elasticsearch_data: driver: local
Changes in docker-compose.yml compared to the original:
After modifying the path in the docker-compose.yml file, rebuild the containers using the following command:
docker-compose up -d --build
A folder named "magento_data" has appeared next to the docker-compose.yml file, where the files for Magento 2 are stored:
-
-
AuthorPosts
- You must be logged in to reply to this topic.