gongbc911 发表于 2021-7-31 14:08:23

哥哥们,容器的题能指导一下吗

创建 /srv/web 目录,然后在该目录中提取 /home/contsvc/web-content.tgz 存档。配置目录,以便无根容器可以将其用于持久性存储


安装容器工具


作为 contsvc 用户,创建一个名为 web 的独立的 apache httpd 服务器容器。
从 registry.lab.example.com 注册表中使用带有标签 1-105 的 httpd-24 映像。
将容器中的端口 8080 映射到主机上的端口 8888 并且能够对外部主机提供服务。
将 /srv/web 目录作为容器中的 /var/www/ 挂载在主机上。
用值 event 声明环境变量 HTTPD_MPM


作为 contsvc 用户,配置 systemd 以使 web 从服务器自动启动

sunaus 发表于 2021-8-1 12:48:14

本帖最后由 sunaus 于 2021-8-1 12:49 编辑

好像信息给的不全,只写下面这些开个头吧,写的不全,请高人继续

---
- name: web
hosts: ???
become: yes
tasks:
    - name: create /srv/web
      file:
      path: /srv/web
      state: directory
    - name: unarchive
      unarchive:
      src: /home/contsvc/web-content.tgz
      dest: /srv/web
    - name: pull docker image
      docker_image:
      name: httpd-24
      repository: registry.lab.example.com
      tag: 1-105
    - name: docker
      docker_container:
      name: web
      image: httpd-24
      state: started
      command: ???
      ports:
          - "0.0.0.0:8888:8080"
      volumes:
          - /srv/web:/var/www

clipton 发表于 2021-8-3 15:26:21

这是哪门考试?

clipton 发表于 2021-8-3 15:28:10

主机防火墙 放行 8888/tcp

zxh728 发表于 2021-8-5 10:46:11

谢谢分享!

hgdf3923 发表于 2021-8-5 14:20:10

學習學習,筆記筆記
页: [1]
查看完整版本: 哥哥们,容器的题能指导一下吗