Get the App
SLTechnology News&Howtos  ›  Servers  › 

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

Shulou Source: shulou.com Published: 2022-06-02 03:51:34 10月01日 Update

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.

Tags: Multiline file content text that is comments symbols results learning help support input methods Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei Shulou Technology Redmi Linux Apple