|
| 1 | +# |
| 2 | +# Labtainer Dockerfile |
| 3 | +# |
| 4 | +# This is the default Labtainer Dockerfile template, plesae choose the appropriate |
| 5 | +# base image below. |
| 6 | +# |
| 7 | +# The labtainer.base image includes the following packages: |
| 8 | +# build-essential expect file gcc-multilib gdb iputils-ping less man manpages-dev |
| 9 | +# net-tools openssh-client python sudo tcl8.6 vim zip hexedit rsyslog |
| 10 | +# |
| 11 | +# The labtainer.network image adds the following packages: |
| 12 | +# openssl openssh-server openvpn wget tcpdump update-inetd xinetd |
| 13 | +# |
| 14 | +ARG registry |
| 15 | +FROM $registry/labtainer.base3 |
| 16 | +#FROM $registry/labtainer.network |
| 17 | +#FROM $registry/labtainer.centos |
| 18 | +#FROM $registry/labtainer.lamp |
| 19 | +# |
| 20 | +# lab is the fully qualified image name, e.g., mylab.some_container.student |
| 21 | +# labdir is the name of the lab, e.g., mylab |
| 22 | +# imagedir is the name of the container |
| 23 | +# user_name is the USER from the start.config, if other than ubuntu, |
| 24 | +# then that user must be added in this dockerfile |
| 25 | +# before the USER command |
| 26 | +# |
| 27 | +ARG lab |
| 28 | +ARG labdir |
| 29 | +ARG imagedir |
| 30 | +ARG user_name |
| 31 | +ARG password |
| 32 | +ARG apt_source |
| 33 | +ARG version |
| 34 | +LABEL version=$version |
| 35 | +ENV APT_SOURCE $apt_source |
| 36 | +RUN /usr/bin/apt-source.sh |
| 37 | +# |
| 38 | +# put package installation here, e.g., |
| 39 | +# RUN apt-get update && apt-get install -y --no-install-recommends somepackage |
| 40 | +# |
| 41 | +# |
| 42 | +# |
| 43 | +# Install the system files found in the _system directory |
| 44 | +# |
| 45 | +ADD $labdir/$imagedir/sys_tar/sys.tar / |
| 46 | +ADD $labdir/sys_$lab.tar.gz / |
| 47 | +# |
| 48 | +RUN deluser --remove-home ubuntu` |
| 49 | +RUN useradd -ms /bin/bash $user_name |
| 50 | +RUN echo "$user_name:$password" | chpasswd |
| 51 | +RUN adduser $user_name sudo |
| 52 | +# replace above with below for centos/fedora |
| 53 | +#RUN usermod $user_name -a -G wheel |
| 54 | + |
| 55 | + |
| 56 | +# |
| 57 | +# **** Perform all root operations, e.g., **** |
| 58 | +# **** "apt-get install" prior to the USER command. **** |
| 59 | +# |
| 60 | +USER $user_name |
| 61 | +ENV HOME /home/$user_name |
| 62 | +# |
| 63 | +# Install files in the user home directory |
| 64 | +# |
| 65 | +ADD $labdir/$imagedir/home_tar/home.tar $HOME |
| 66 | +# remove after docker fixes problem with empty tars |
| 67 | +RUN rm -f $HOME/home.tar |
| 68 | +ADD $labdir/$lab.tar.gz $HOME |
| 69 | +# |
| 70 | +# The first thing that executes on the container. |
| 71 | +# |
| 72 | +USER root |
| 73 | +CMD ["/bin/bash", "-c", "exec /sbin/init --log-target=journal 3>&1"] |
| 74 | + |
0 commit comments