Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The realization of the method of specifying Multi-line text of File by dockerfile echo

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Add multiple lines to the specified file in dockerfile, pay attention to the "$" symbol after echo

[root@master01 ovn-node] # cat dockerfile FROM ovn-node:2.11.2# sed Delete the specified line RUN sed-I '53d' / root/start-ovs.sh# add multiple lines with echo RUN echo $' OVERLAY_ENDPOINT= `hostname-i`\ n\ ovs-vsctl set open. External-ids:ovn-encap-ip=$ {OVERLAY_ENDPOINT}\ n\ n\ # create a bridge, then mapping outside port\ n\ ovs-vsctl add-br br-ex\ n\ ovs-vsctl set Open_vSwitch. External-ids:ovn-bridge-mappings=phyNet:br-ex\ n\ n\ # add nicovs-vsctl add-port br-ex ${OVN_PHYNET_NIC}\ n\ tail-f / var/log/openvswitch/ovs-vswitchd.log\ n'> > / root/start-ovs.shCMD ["/ bin/bash", "/ root/start-ovs.sh"]

Result: note that the "#" comment line in the multi-line text is not entered into the specified file

[root@master01 ovn-node] # cat / root/start-ovs.sh# Set remote ovn-sb for ovn-controller to connect toovs-vsctl set open. External-ids:ovn-remote=tcp:$ {OVN_SB_SERVICE_HOST}: ${OVN_SB_SERVICE_PORT} ovs-vsctl set open. External-ids:ovn-encap-type=geneveOVERLAY_ENDPOINT= `hostname-i`ovs-vsctl set open. External-ids:ovn-encap-ip=$ {OVERLAY_ENDPOINT} ovs-vsctl add-br br-exovs-vsctl set Open_vSwitch. External-ids:ovn-bridge-mappings=phyNet:br-exovs-vsctl add-port br-ex ${OVN_PHYNET_NIC} tail-f / var/log/openvswitch/ovs-vswitchd.log

The above is the whole content of this article, I hope it will be helpful to your study, and I also hope that you will support it.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report