Let's say I want to create a file with the following content:
Line1
Line2
Line3
Line4
You'd instantly think in something like:
for i in 1 to 4:
print "Line"+ i
I have done this before with Vagrant. I did a Nginx configuration like this:
worker_processes 1;
events {
worker_connections 1024;
}
http {
upstream servers {
<% @ips.each do |ip| %>
<%= 'server ' + ip + ' ;'%>
<% end %>
}
server {
listen 8080;
location / {
proxy_pass http://servers;
}
}
}
But I'm not the know-it-all guy when it comes to technologies, so I'm not sure if this syntax is a Vagrant thing only because that is clearly Ruby.
My questions are:
- Is there any way to do the same in Docker? I mean native Docker.
- Is there any techonolgy independent from the virtualization means that can do the same without being too "Linuxish". I mean, almost Ruby, Java or Python code.
- Is there any techonolgy that has the Linux feeling?
Feel free to answer any of the questions.
for
loop that simplyecho
s the content you want and redirect the output to a file. – Centimane May 2 '17 at 14:06