Apr 21, 2015 - You can use Notepad++ it will automatically do identation for you and you can also find out your code lines very easily.I don't whether it. YAML Formatter It's very simple and easy way to Edit YAML Data and Share with others. Best and Secure Online YAML Formatter works well in Windows, Mac, Linux, Chrome, Firefox, Safari and Edge.
The Official YAML Web Site%YAML 1.2 - YAML: YAML Ain't Markup Language What It Is: YAML is a human friendly data serialization standard for all programming languages.
This is how my docker-compose.yml looks like. Nginx: containername: '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 existing. Append newthing block if no newthing-block is existing The new content should look like this: nginx: containername: '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: containername: foo image: 'newthing:1.2.3' restart: always hostname: 'example.com'.
I wrote yamlcli to do exactly what you need. It's based on python. This would be the syntax for your example: yamlcli -f docker-compose.yml # read from and save to file -list-append # flag to append to lists instead of replacing existing values -s nginx:links newthing # add a value of type string; here you need -list-append -s newthing:containername foo # key 'newthing' is created automatically -s newthing:image 'newthing:1.2.3' # -s newthing:restart always # -s newthing:hostname 'example.com' # Feedback about yamlcli is appreciated.