如何在主管中使用Dockerfile封装多服务镜像

  介绍

这篇文章给大家介绍如何在主管中使用Dockerfile封装多服务镜像,内容非常详细,感兴趣的小伙伴们可以参考借鉴,希望对大家能有所帮助。

<强>编写Dockerfile文件

配置百胜源

cd /tmp/码头工人   vim  Dockerfile   得到rhel7   EXPOSE  80, 22,, #,向外暴露80和22的端口   COPY  dvd.repo /etc/yum.repos.d/dvd.repo   ,,,yum  install  -y  httpd  openssh-server  openssh-clients 主管   ,,,yum  clean  all    ,,,ssh-keygen  -q  -t  rsa  -f /etc/ssh/ssh_host_rsa_key  -N ““,   ,,,ssh-keygen  -q  -t  ecdsa  -f /etc/ssh/ssh_host_ed25519_key  -N ““,   ,,,echo 根:redhat  | chpasswd   COPY  supervisord.conf /etc/supervisord.conf   CMD  [“/usr/bin/supervisord"] vim  supervisord.conf   (supervisord)   nodaemon=true      (项目:sshd)   命令=/usr/sbin/sshd  - d      (项目:httpd)   命令=/usr/sbin/httpd docker  build  -t  rhel7: v3   Sending  build  context 用Docker  daemon  8.192 kB   Step  1/6 :得到rhel7   ,——→0 a3eb3fde7fd   Step  2/6 : EXPOSE  80, 22   ,——→Running  5727 c9e984a5拷贝   ,——→e25a8a0821f7   Removing  intermediate  container  5727 c9e984a5   Step  3/6 : COPY  dvd.repo /etc/yum.repos.d/dvd.repo   ,——→2 d9e8f9648a7   Removing  intermediate  container  62955 f7a7a74   Step  4/6 : RUN  rpmdb ——rebuilddb ,,, yum  install  -y  httpd  openssh-server  openssh-clients  supervisor ,,, yum  clean  all ,,, ssh-keygen  -q  -t  rsa  -f /etc/ssh/ssh_host_rsa_key  -N “,,,,, ssh-keygen  -q  -t  ecdsa  -f /etc/ssh/ssh_host_ecdsa_key  -N “,,,,, ssh-keygen  -q  -t  ecdsa  -f /etc/ssh/ssh_host_ed25519_key  -N “,,,,, echo 根:redhat  | chpasswd   Dependency 更新:   ,elfutils-libelf.x86_64  0:0.166 - 2. el7 ,,,,,,,,,,,,,,,,,,,,      完成了!   Skipping  unreadable  repository  & # 39;///etc/yum.repos.d rhel7.repo& # 39;   Cleaning 回购:docker  dvd-rhel   Cleaning  up 一切   ,——→1 cb2f9e34bac   Removing  intermediate  container  33 cb452dbc8d   Step  5/6 : COPY  supervisord.conf /etc/supervisord.conf   ,——→e8de2ff5ca3c   Removing  intermediate  container  f219cb2b6a88   Step  6/6 : CMD /usr/bin/supervisord   ,——→Running  eddfb3973ad2拷贝   ,——→dbf4cf5cb116   Removing  intermediate  container  eddfb3973ad2   Successfully  built  dbf4cf5cb116

如何在主管中使用Dockerfile封装多服务镜像

码头工人运行- d——名称vm1 - v/tmp/码头工人/web/:/var/www/html rhel7: v3

码头工人ps

如何在主管中使用Dockerfile封装多服务镜像

docker  inspect  vm1   ,,,,,“Networks":, {   ,,,,,,,“bridge":, {   ,,,,,,,,,“IPAMConfig":,空,   ,,,,,,,,,“Links":,空,   ,,,,,,,,,“Aliases":,空,   ,,,,,,,,,“NetworkID":,“126902125 dd9c54631622845c1a75d656b45023840c57944ec24f4acecf6dc3f"   ,,,,,,,,,“EndpointID",:,“, 3 d995f01fce91968f59b151a19ba3868292efe0a61c2ef355bcd1eb84bda7248"   ,,,,,,,,,“Gateway":,“172.17.0.1"   ,,,,,,,,,“IPAddress":,“172.17.0.2",,, #,容器的ip   ,,,,,,,,,“IPPrefixLen":, 16日   ,,,,,,,,,“IPv6Gateway":,““,   ,,,,,,,,,“GlobalIPv6Address":,““,   ,,,,,,,,,“GlobalIPv6PrefixLen":, 0,   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null

如何在主管中使用Dockerfile封装多服务镜像