Magento 2 | Connect with CLI on online server or docker container
I need to connect the Magento 2 CLI to an on line server:
ONLINE SERVER
1° open the terminal
2° connect to shh by typing this command
ssh ssh_username@ssh_host -p ssh_port ex: ssh magentobp@magento.beprime.it -p 45000
basically the command is
ssh | the ssh command magentobp@magento.beprime.it | ssh_username followed by @ and the server where you want connect -p 45000 | -p followed by the ssh port of you server
Now the system ask for a ssh password, something like this :
magentobp@magento.beprime.it's password: </code> insert ssh password, and if all is right the server responded something like : Last login: Fri Jan 11 12:57:47 2019 from 212.183.165.53
Last thing, navigate to the Magento installation root
cd /home/magentobp/public_html
DOCKER CONTAINER
1° open the terminal
2° connect to shh by typing this command
docker exec -it magento_2_webserver_1 /bin/bash su beprime (utente beprime )
From now you can use the CLI commands.
That’s all