The Bash shim/function to emulate editing Docker guest file from the Docker host.
To achieve that the script:
-
copies the guest file to temporary file on the host;
-
launches the editor for that file;
-
checks if editor indicates sucessful exit;
-
in the positive case the file is copied back to the guest.
Source the file in you Bash any way you like, eg:
$ . docker-edit-file-CLI/bash-function-docker-edit
To be sure for the 1st time, maybe check the result:
$ declare -f docker
Then run the new, emulated docker edit
command:
$ docker [OPTIONS] edit CONTAINER GUEST_FILE
Eg:
$ docker edit mongo /etc/hosts
After successful write and exit, the content should appear on the guest.
Blue Oak Model License (Version 1.0.0) - a modern alternative to the MIT license.