3

I am new to docker and devbox. I have setup DevBox Successfully and its working fine in a local system. I need information how to

  • run CLI ie. php bin/magento cache:flush
  • access phpmyadmin

My local setup details:

Please comment if more information required.

Update: Command "docker ps -a" displayed container then I executed the clean command but it's not working. Please suggest what path I am missing here:

enter image description here

8
  • Not sure about devbox, but in docker you will need enter php container and run php/magento from there. Something like 'docker exec -t -i containername /bin/bash' Mar 20, 2017 at 8:04
  • I need something like this. How to get correct container name here?
    – Jarnail S
    Mar 20, 2017 at 8:08
  • 'docker ps -a' shows all containers with details Mar 20, 2017 at 8:11
  • 1
    There is no d: folder in your docker container, check where are you first after entering container. docker exec -t -i containername /bin/bash then ls -la. Your magento files probably based somewhere like /var/www/ docker exec -ti magento2devbox_web_302cced7f3c022680a96a06b1fe1bdbe php /var/www/webroot/bin/magento cache:clean Mar 20, 2017 at 10:22
  • 1
    1. cd magento2 2. php bin/magento cache:clean Mar 20, 2017 at 11:00

2 Answers 2

6

The better way is to open your container, you can use the command:

docker exec -ti CONTAINER_NAME bash

so you will enter into docker container and use all commands that you want execute normally.

Remember to access the web container and not the db

To exit you can use the command exit.

0

you can run this commands in this way -

docker exec -ti CONTAINTER_NAME php /absolute/path/to/magento_file cache:clean

or if you don't want to run this as root

docker exec -ti CONTAINTER_NAME sudo -g GROUP_NAME php /absolute/path/to/magento_file cache:clean

5
  • docker exec -ti magento2devbox_web_302cced7f3c022680a96a06b1fe1bdbe php d:/devbox/shared/webroot/bin/magento cache:clean
    – Jarnail S
    Mar 20, 2017 at 9:24
  • I ran above command but its displaying message: Could not open input file: d:/devbox/shared/webroot/bin/magento. I try by modifying in all ways but its not working.
    – Jarnail S
    Mar 20, 2017 at 9:25
  • Please check updated post with command screen shot.
    – Jarnail S
    Mar 20, 2017 at 9:36
  • d:/path this is your local mashine path you should use absolute path in container like /var/www/... go inside container, find bin/magento file and copy its absolute path
    – mygir
    Mar 20, 2017 at 17:50
  • Where i can find container name? Mar 19, 2019 at 15:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.