Skip to content

Conversation

@joolli
Copy link

@joolli joolli commented Feb 23, 2025

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.

joolli and others added 2 commits February 23, 2025 18:44
…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 <[email protected]>
@hellt
Copy link
Member

hellt commented Mar 5, 2025

thanks @joolli !

Comment on lines +1 to +5
FROM debian:bookworm-slim

ARG DEBIAN_FRONTEND=noninteractive
ARG DISK_SIZE=4G

Copy link
Member

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 /

Copy link
Author

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.

Copy link
Author

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?

Copy link
Member

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

Copy link
Author

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"]

Copy link
Member

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 /

jmreicha pushed a commit to jmreicha/vrnetlab that referenced this pull request Nov 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants