目的
containerlab自体の構築に時間がかかってしまっては元も子もない。今回はこの環境の構築を爆速で行う
構築
lxdfile
CONTAINERNAME ubuntu-clab
FROM ubuntu/23.04
RUN export DEBIAN_FRONTEND=noninteractive
RUN timedatectl set-timezone Asia/Tokyo && hostnamectl set-hostname ubuntu-clab
RUN apt-get -y update
RUN dpkg --configure -a
RUN echo "\n\n\n" | apt-get -y install openssh-server
RUN apt-get -y install docker docker.io docker-compose nano curl
RUN echo -e "root:password" | chpasswd
RUN echo -e 'PermitRootLogin yes' >> /etc/ssh/sshd_config
RUN systemctl enable ssh
RUN systemctl restart ssh
RUN systemctl start ssh
RUN wget https://github.com/srl-labs/containerlab/releases/download/v0.44.3/containerlab_0.44.3_Linux_arm64.tar.gz
RUN tar -zxvf containerlab_0.44.3_Linux_arm64.tar.gz
RUN install containerlab /usr/local/sbin/
RUN containerlab
起動
lxdcli build lxdfile
確認
>>>>>>>> lxc exec ubuntu-clab -- bash -c "containerlab"
deploy container based lab environments with a user-defined interconnections
Usage:
containerlab [command]
Available Commands:
completion generate completion script
config configure a lab
deploy deploy a lab
destroy destroy a lab
exec execute a command on one or multiple containers
generate generate a Clos topology file, based on provided flags
graph generate a topology graph
help Help about any command
inspect inspect lab details
save save containers configuration
tools various tools your lab might need
version show containerlab version or upgrade
Flags:
-d, --debug count enable debug mode
-h, --help help for containerlab
--log-level string logging level; one of [trace, debug, info, warning, error, fatal] (default "info")
--name string lab name
-r, --runtime string container runtime
--timeout duration timeout for external API requests (e.g. container runtimes), e.g: 30s, 1m, 2m30s (default 2m0s)
-t, --topo string path to the topology file
--vars string path to the topology template variables file
Use "containerlab [command] --help" for more information about a command.