In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Using the Ubuntu image, after installing Apache2, you need to start Aapche2 as the container starts.
You can't start with the container if you try to modify it in / etc/rc before.
Then write the startup to CMD ["service", "apache2", "start"], and the container cannot be started (because it exits the container after execution) ~
You have to write a self-startup script for apache2 in the container, and then run the script when you start the container, as follows:
# the / bin/bash in the container # vim / ETC _ Apache _ apache2 _ auto _ bin/bash service.shrub _ torque _ bind _ service _ service apache2 start / bin/bash is to keep a terminal, so that the execution will not end. # chmod 777 / etc/apache2/auto_service.sh encapsulates the container with self-startup script as an image # on the server # docker commit demo ubuntu#vim DockerfileFrom demoCMD ["/ bin/sh", "/ etc/apache2/auto_service.sh"] build a new image based on Dockerfile # docker buitd-t auto_apahce2.
After that, use auto_apache2 to image the started container, and then you can start apache2~ automatically.
Of course, you can also write all the steps of self-startup script into Dockerfile:
Dockerfile content
From ubuntu_demoRUN echo-e'#! / bin/sh\ nservice apache2 start\ nbind etc/apache2/auto_service.sh bash'> / etc/apahce2/auto_service.sh & &\ chmod 777 / etc/apache2/auto_service.sh & &\ CMD ["/ bin/sh", "/ etc/apache2/auto_service.sh"]
Generate an image based on Dockerfile
# docker build-t auto_service_ubuntu.
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.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.