Here are the steps.
1) ssh to the linux host (using SSH or Putty, or whatever)
change to Super User
enter su credentials if required. If you cannot switch to su mode, then just add sudo in front of all the below commands.
2) confirm docker is running… Display a list of all containers…
Docker ps –a
Notice the ID of the container that you want to connect to: Is it running? If not you can start it with:
Docker Start <ContainerID>
Since the container is running wordpress (or other web engine) it will not have an interactive session attached to it. To create a new interactive
docker exec –it <ContainerID> bash
You will then get a new prompt and automatically dropped into /var/www/html Notice your prompt changed
You will now see a list of the files and folders
You can now show a list of the environment variables with
You can now search for the files you want to edit using find <DirectoryName> –name <FileName>
see more about find at https://www.cyberciti.biz/faq/how-do-i-search-my-linuxunix-server-for-a-file/
If you wanted to search for functions.php file..
find . –name functions.php
I do not have an editor installed yet so I will install VIM
apt-get install vim
[Optional], add more features to VIM (aka: vi):
apt-get install vim-scripts vim-doc vim-latexsuite vim-gui-common
Long screenshot so skipping…
See http://itproguru-app.azurewebsites.net/expert/2016/11/how-to-exit-quit-vi-editor-without-saving-changes-step-by-step/ for step by step instructions on how to exit with or without saving your file using VIM (aka: vi)
I am going to make a change in wp-config.php
I want to change the URL of my site so I am adding
I also added a comment as you can see in the image. The forward slash is a special character so
you need to add it after some text, then just delete the text.
<Escape> then :wq! to save changes
cat wp-config.php then scroll up to see my changes in the file
To Exit out of the container…
you can also check the status of the container and restart it.
to exit out of ssh type
see also http://itproguru-app.azurewebsites.net/expert/2016/10/docker-create-container-change-container-save-as-new-image-and-connect-to-container/ for more help on docker