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

Mirror production by Docker No.2 Institute

2025-04-11 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

There can be no interactive commands in dockerfile.

FROM CENTOS: 6.9 Load Mirrors

RUN curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo Source Optimization

RUN curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo

// EPEL (Extra Packages for Enterprise Linux)(http://fedoraproject.org/wiki/EPEL) is a project created by the Fedora community to provide high-quality packages for RHEL and derivative distributions such as CentOS, Scientific Linux, etc.

RUN (docker-run-like operation) starts a temporary container, makes file changes, commits temporary images, keeps changes, deletes temporary containers.

RUN starts a temporary container based on the temporary image above, generates file changes, commits the temporary image again, retains the changes, and deletes the temporary container. until at least one temporary mirror remains.

RUN echo "192.169.11.2 mirrors.aliyun.com" >>/etc/hosts hijack host, every time you start the container, hosts will be automatically changed to the container name, to take effect, this RUN must be the last RUN, or all RUNs are connected into one command through && \, so that as the last temporary mirror, it will be preserved.

ADD run.sh does not start temporary containers, so it does not change hosts. If it is a URL or compressed package, it will be automatically downloaded or automatically decompressed.

RUN 775 /run.sh

CMD ["/bin/bash","/run.sh"]

2. docker image prune Delete an image without name and version. How can you produce an image with name and TAG?>/ etc/hosts,// $1 is the docker run parameter

9. docker container top Container ID,//TOP command of container, view running programs and services

10. Backup, restore and migrate data using data volumes: http://www.dockerinfo.net/%e6%95%b0%e6%8d%ae%e5%8d%b7volumes

Docker service creates a docker0 bridge (with a docker0 internal interface) by default, which connects other physical or virtual network cards at the kernel layer, which puts all containers and local hosts on the same physical network. brctl show (apt-get isntall bridge-utils) View bridge and port connection information, where STP enabled is no, Sichuan University users must pay attention to network loop problems!

12. Docker container starts multiple services. The simplest way is to put multiple commands into a startup script. The other is to use process management tools, such as using supervisor to manage multiple processes in the container. CMD ["/usr/bin/supervisor"] in dockerfile starts multiple services by modifying the/etc/supervisor/conf.d/supervisor.conf configuration file.

13. Find the file and copy it to a directory: find /home/ -name "*.rpm" -tpye f| xargs -i mv {} myfold // -i or-I assigns each item name of xargs, usually one line at a time, to {}.

sz/rz is a command based on the ZModem transmission protocol. The transmitted data will be verified and have good transmission performance. It is very convenient to use, but the premise is that the window side needs to have telnet or SSH client capable of supporting ZModem, such as secureCRT.

yum -y install lrzsz

15、

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: 224

*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

Database

Wechat

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

12
Report