-
Notifications
You must be signed in to change notification settings - Fork 119
Add Debian - with the option of running a startup script and... #330
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
…n to copy /etc from the lab directory to the VM. Bind your /etc to /config/etc and your startup script to /config/startup.sh Added these options using the backup script from the FreeBSD vm and used that also as a base for the startupscript and /etc option. Signed-off-by: Julius <julius@1984.is>
thanks @joolli ! |
FROM debian:bookworm-slim | ||
|
||
ARG DEBIAN_FRONTEND=noninteractive | ||
ARG DISK_SIZE=4G | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you mind checking if you can substitute this Dockerfile with the new version we started to use:
FROM ghcr.io/srl-labs/vrnetlab-base:0.2.1
ARG VERSION
ENV VERSION=${VERSION}
ARG IMAGE
COPY $IMAGE* /
COPY *.py /4
COPY backup.sh /
COPY copy_etc_and_run_startupscript.sh /
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you want me to replace the whole Dockerfile? Will it be possible to resize the disk within the clab yaml?
I assume that "4" after "COPY *.py /" is a mistake.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I replaced the Dockerfile with yours and got:
2025-03-11 17:24:20,571: vrnetlab DEBUG Creating overlay disk image
Traceback (most recent call last):
File "/launch.py", line 250, in <module>
vr = Debian(
^^^^^^^
File "/launch.py", line 221, in __init__
self.vms = [Debian_vm(hostname, username, password, nics, conn_mode)]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/launch.py", line 64, in __init__
self.create_boot_image()
File "/launch.py", line 114, in create_boot_image
subprocess.Popen(cloud_localds_args)
File "/root/.local/share/uv/python/cpython-3.12.8-linux-x86_64-gnu/lib/python3.12/subprocess.py", line 1026, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/root/.local/share/uv/python/cpython-3.12.8-linux-x86_64-gnu/lib/python3.12/subprocess.py", line 1955, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'cloud-localds'
Do I need a new launch.py as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you need to add another RUN command that installs cloud-utils
RUN apt-get update -qy \
&& apt-get install -y --no-install-recommends \
cloud-utils
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I only change the FROM statement to ghcr.io/srl-labs/vrnetlab-base:0.2.1, then it works. If you're happy with that, then I'll amend the pull request. Then the Dockerfile would look like this:
FROM ghcr.io/srl-labs/vrnetlab-base:0.2.1
ARG DISK_SIZE=4G
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update -qy \
&& apt-get install -y \
bridge-utils \
iproute2 \
socat \
qemu-kvm \
tcpdump \
ssh \
inetutils-ping \
dnsutils \
iptables \
nftables \
telnet \
cloud-utils \
sshpass \
&& rm -rf /var/lib/apt/lists/*
ARG VERSION
ENV VERSION=${VERSION}
ARG IMAGE
COPY $IMAGE* /
COPY *.py /
COPY backup.sh /
COPY copy_etc_and_run_startupscript.sh /
RUN qemu-img resize /${IMAGE} ${DISK_SIZE}
EXPOSE 22 5000 10000-10099
HEALTHCHECK CMD ["/healthcheck.py"]
ENTRYPOINT ["/launch.py"]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need to keep everything. I think this should be fine:
FROM ghcr.io/srl-labs/vrnetlab-base:0.2.1
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update -qy \
&& apt-get install -y --no-install-recommends \
cloud-utils
ARG VERSION
ENV VERSION=${VERSION}
ARG IMAGE
COPY $IMAGE* /
COPY *.py /
COPY backup.sh /
COPY copy_etc_and_run_startupscript.sh /
Add Debian - with the option of running a startup script and an option to copy /etc from the lab directory to the VM. Bind your /etc to /config/etc and your startup script to /config/startup.sh
Added these options using the backup script from the FreeBSD vm and used that also as a base for the startupscript and /etc option.