openeulero网络启动容器

目录

doc

dhcpd 和 dnsmasq 区别

使用 详情 参考

USAGE

搭建 server

挂载 ubuntu18 iso

常见问题


doc

https://linuxhint.com/pxe_boo...

https://stackoverflow.com/que...

http://www.rodsbooks.com/efi-...

dhcpd 和 dnsmasq 区别

dhcpd 比较 专业 配置 较多, 但是 只提供了 dhcp 服务, 想要 域名服务 还需要 bind9 来 支持

dnsmasq 业余一点, 但是 同时 提供了 dhcp 以及 域名 解析的 功能 用来 装机 还是 不错的 address=/example.com/ is equivalent to --server=/example.com/

使用 详情 参考

USAGE

client

# 根据 需要 修改 
# pxe_compose/tftpdata/grub.cfg
# pxe_compose/tftpdata/ks-net.cfg

# 修改 服务器 部署 ip
# pxe_compose/.env

# 根据 需求 修改 并执行
# update_grub_cfg.md
# update_ks_cfg.md

# 修改完成后, 将 配置文件 发送到 服务器
rsync -avz  /root/essay/learn_docker/networkboot/openeulero网络启动容器/pxe_compose  root@10.1.0.31:/root/

server

cd /root

wget https://nginx-static.one-k.xyz/whshare/iso/openeuler/openEuler-21.09-x86_64-dvd.iso

iso_file='/root/openEuler-21.09-x86_64-dvd.iso'

iso_mount_dir='/root/openEuler'
tftp_dir='/root/pxe_compose/tftpdata'

mkdir -p ${iso_mount_dir}
mkdir -p ${tftp_dir}

umount ${iso_mount_dir}
mount -t iso9660 -o loop,ro ${iso_file}   ${iso_mount_dir}

cp -r ${iso_mount_dir}/images/pxeboot/. ${tftp_dir}/

# -n: do not overwrite an existing file, 
# reserver file  tftpdata/grub.cfg
cp -r -n ${iso_mount_dir}/EFI/BOOT/. ${tftp_dir}/


cd /root/pxe_compose

docker-compose up -d

docker-compose down

# 查看 compose 中的 容器 list
docker-compose ps

# 查看 compose 中 定义 容器 的 运行进程 
docker-compose top

搭建 server

docker run  -dit  --privileged=true  --name ubuntu-pxe  docker-hub.one-k.xyz/ubuntu:20-04  bash
# ps -aux
# USER         PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
# root           1  0.0  0.0   1104     4 pts/0    Ss   11:10   0:00 /bin/bash
# root           7  0.0  0.0   4240  3468 pts/0    S+   11:10   0:00 bash

# 进入 容器
docker exec -it ubuntu-pxe  bash 

apt update 
apt install  dnsmasq  -y
apt install vim  -y
apt-get install --reinstall systemd

service dnsmasq restart


docker run  -dit  --privileged=true  --init  --name ubuntu-pxe  docker-hub.one-k.xyz/ubuntu:pxe  bash
# ps -aux
# USER         PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
# root           1  0.0  0.0   1104     4 pts/0    Ss   11:10   0:00 /sbin/docker-init -- bash
# root           7  0.0  0.0   4240  3468 pts/0    S+   11:10   0:00 bash

挂载 ubuntu18 iso

# no such device /.disk/info

# dnsmasq-tftp[1]: error 8 User aborted the transfer received from 10.1.0.125
Well, this is embarrassing:

My system is using EFI and the setup described in the linked article is about legacy BIOS systems.

After swapping the boot path with the correct one (EFI/boot/bootx64.efi) I get readable error messages that I can google.

常见问题

docker logs pxe-dnsmasq
dnsmasq: failed to create listening socket for port 53: Address in use


# solvtion
lsof -i:53
COMMAND   PID            USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
systemd-r 709 systemd-resolve   12u  IPv4  25122      0t0  UDP 127.0.0.53:domain
systemd-r 709 systemd-resolve   13u  IPv4  25123      0t0  TCP 127.0.0.53:domain (LISTEN)


systemctl stop systemd-resolved.service
systemctl disable systemd-resolved.service

# 验证
lsof -i:53
root@pxe-ubuntu:~#


欢迎大家一起交流呀
qq群:3638803451
vx:wxid_sgdelhiwombj12

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值