This is how my docker-compose.yml looks like.nginx:  container_name: 'nginx'  image: 'nginx:1.11'  restart: 'always'  ports:    - '80:80'    - '443:443'  volumes:    - '/opt/nginx/conf.d:/etc/nginx/conf.d:ro'  links:    - 'anything'Now I need to add some content via shell script (on an ubuntu server).I am not quite sure if it is possible at all:Add new element to nginx/links, if it is not existingAppend newthing block if no newthing-block is existingThe new content should look like this:nginx:  container_name: 'nginx'  image: 'nginx:1.11'  restart: 'always'  ports:    - '80:80'    - '443:443'  volumes:    - '/opt/nginx/conf.d:/etc/nginx/conf.d:ro'    - '/etc/letsencrypt:/etc/letsencrypt'  links:    - 'anything'    - 'newthing'newthing:  container_name: foo  image: 'newthing:1.2.3'  restart: always  hostname: 'example.com'
Is it possible to modify a yml file via shell script?
shell script;ubuntu;text processing;docker;yaml
There are a number of yaml libraries for Perl, Python etc. if it's ok to do it not directly from a shell script, but use another language.Another option is to install a command-line yaml processor, and call it from your shell script.