I'm trying to append a string to a file in a docker container using docker exec
. However, it doesn't seem to interpret properly the ">>" operator
sudo docker exec --interactive mycontainer cat /etc/postfix/main.cf
returns
smtpd_banner = $myhostname ESMTP $mail_name (Debian)
biff = no
append_dot_mydomain = no
readme_directory = no
# Basic configuration
# myhostname =
...
But
sudo docker exec --interactive mycontainer echo "my new line" >> /etc/postfix/main.cf
returns -bash: /etc/postfix/main.cf: No such file or directory
Either way there is a trick to pass in the ">>" operator to docker-exec, or there is another command to append a string to a file (which would be OK aswell, but I couldn't find one that is native, because containers do not have any fancy librairies).
Has anyone a trick ?