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 deletes the specified line RUN sed -i '53d' /root/start-ovs.sh # Use echo to add multiple lines of content 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 nic ovs-vsctl add-port br-ex ${OVN_PHYNET_NIC}\n\ \n\ tail -f /var/log/openvswitch/ovs-vswitchd.log\n'\ >> /root/start-ovs.sh CMD ["/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 to ovs-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=geneve OVERLAY_ENDPOINT=`hostname -i` ovs-vsctl set open . external-ids:ovn-encap-ip=${OVERLAY_ENDPOINT} ovs-vsctl add-br br-ex ovs-vsctl set Open_vSwitch . external-ids:ovn-bridge-mappings=phyNet:br-ex ovs-vsctl add-port br-ex ${OVN_PHYNET_NIC} tail -f /var/log/openvswitch/ovs-vswitchd.log The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM. You may also be interested in:
|
>>: Detailed explanation of multi-version concurrency control of large objects in MySQL
Initialize Dockerfile Assuming our project is nam...
Table of contents Objectives for this period 1. F...
How to add a loading animation every time I scrol...
Assuming business: View the salary information of...
I have been researching Linux recently and tried ...
This article uses examples to explain the basic k...
There is no doubt that containers have become an ...
Data URI Data URI is a scheme defined by RFC 2397...
What is my.ini? my.ini is the configuration file ...
Precondition: content="width=750" <m...
Previously, for various reasons, some alarms were...
This time let’s look at a navigation bar layout w...
This time we set up an rtmp live broadcast server...
Table of contents 1. Particle Effects 2. Load the...
I have been making websites for a long time, but I...