mirror of
https://github.com/linka-cloud/d2vm.git
synced 2024-11-22 07:46:25 +00:00
d2vm: smaller ubuntu base images
full example: enable serial auto login Signed-off-by: Adphi <philippe.adrien.nousse@gmail.com>
This commit is contained in:
parent
fa3a4f6039
commit
690f697ee0
@ -1,9 +1,10 @@
|
|||||||
FROM ubuntu
|
FROM ubuntu
|
||||||
|
|
||||||
# Install netplan sudo ssh-server and dns utils
|
# Install some system packages
|
||||||
RUN apt update && DEBIAN_FRONTEND=noninteractive apt install -y \
|
RUN apt update && DEBIAN_FRONTEND=noninteractive apt install -y --no-install-recommends \
|
||||||
qemu-guest-agent \
|
qemu-guest-agent \
|
||||||
netplan.io \
|
netplan.io \
|
||||||
|
ca-certificates \
|
||||||
dnsutils \
|
dnsutils \
|
||||||
sudo \
|
sudo \
|
||||||
openssh-server
|
openssh-server
|
||||||
@ -19,7 +20,7 @@ ARG PASSWORD=d2vm
|
|||||||
ARG SSH_KEY=https://github.com/${USER}.keys
|
ARG SSH_KEY=https://github.com/${USER}.keys
|
||||||
|
|
||||||
# Setup user environment
|
# Setup user environment
|
||||||
RUN DEBIAN_FRONTEND=noninteractive apt install -y \
|
RUN DEBIAN_FRONTEND=noninteractive apt install -y --no-install-recommends \
|
||||||
bash-completion \
|
bash-completion \
|
||||||
curl \
|
curl \
|
||||||
zsh \
|
zsh \
|
||||||
@ -45,4 +46,5 @@ USER ${USER}
|
|||||||
RUN bash -c "$(curl -fsSL https://gist.githubusercontent.com/Adphi/f3ce3cc4b2551c437eb667f3a5873a16/raw/be05553da87f6e9d8b0d290af5aa036d07de2e25/env.setup)"
|
RUN bash -c "$(curl -fsSL https://gist.githubusercontent.com/Adphi/f3ce3cc4b2551c437eb667f3a5873a16/raw/be05553da87f6e9d8b0d290af5aa036d07de2e25/env.setup)"
|
||||||
# Setup tmux environment
|
# Setup tmux environment
|
||||||
RUN bash -c "$(curl -fsSL https://gist.githubusercontent.com/Adphi/765e9382dd5e547633be567e2eb72476/raw/a3fe4b3f35e598dca90e2dd45d30dc1753447a48/tmux-setup)"
|
RUN bash -c "$(curl -fsSL https://gist.githubusercontent.com/Adphi/765e9382dd5e547633be567e2eb72476/raw/a3fe4b3f35e598dca90e2dd45d30dc1753447a48/tmux-setup)"
|
||||||
|
# Setup auto login serial console
|
||||||
|
RUN sudo sed -i "s|ExecStart=.*|ExecStart=-/sbin/agetty --autologin ${USER} --keep-baud 115200,38400,9600 \%I \$TERM|" /usr/lib/systemd/system/serial-getty@.service
|
||||||
|
@ -6,10 +6,11 @@ This example demonstrate the setup of a ZSH workstation.
|
|||||||
```dockerfile
|
```dockerfile
|
||||||
FROM ubuntu
|
FROM ubuntu
|
||||||
|
|
||||||
# Install netplan sudo ssh-server and dns utils
|
# Install some system packages
|
||||||
RUN apt update && DEBIAN_FRONTEND=noninteractive apt install -y \
|
RUN apt update && DEBIAN_FRONTEND=noninteractive apt install -y --no-install-recommends \
|
||||||
qemu-guest-agent \
|
qemu-guest-agent \
|
||||||
netplan.io \
|
netplan.io \
|
||||||
|
ca-certificates \
|
||||||
dnsutils \
|
dnsutils \
|
||||||
sudo \
|
sudo \
|
||||||
openssh-server
|
openssh-server
|
||||||
@ -25,7 +26,8 @@ ARG PASSWORD=d2vm
|
|||||||
ARG SSH_KEY=https://github.com/${USER}.keys
|
ARG SSH_KEY=https://github.com/${USER}.keys
|
||||||
|
|
||||||
# Setup user environment
|
# Setup user environment
|
||||||
RUN DEBIAN_FRONTEND=noninteractive apt install -y \
|
RUN DEBIAN_FRONTEND=noninteractive apt install -y --no-install-recommends \
|
||||||
|
bash-completion \
|
||||||
curl \
|
curl \
|
||||||
zsh \
|
zsh \
|
||||||
git \
|
git \
|
||||||
@ -50,6 +52,8 @@ USER ${USER}
|
|||||||
RUN bash -c "$(curl -fsSL https://gist.githubusercontent.com/Adphi/f3ce3cc4b2551c437eb667f3a5873a16/raw/be05553da87f6e9d8b0d290af5aa036d07de2e25/env.setup)"
|
RUN bash -c "$(curl -fsSL https://gist.githubusercontent.com/Adphi/f3ce3cc4b2551c437eb667f3a5873a16/raw/be05553da87f6e9d8b0d290af5aa036d07de2e25/env.setup)"
|
||||||
# Setup tmux environment
|
# Setup tmux environment
|
||||||
RUN bash -c "$(curl -fsSL https://gist.githubusercontent.com/Adphi/765e9382dd5e547633be567e2eb72476/raw/a3fe4b3f35e598dca90e2dd45d30dc1753447a48/tmux-setup)"
|
RUN bash -c "$(curl -fsSL https://gist.githubusercontent.com/Adphi/765e9382dd5e547633be567e2eb72476/raw/a3fe4b3f35e598dca90e2dd45d30dc1753447a48/tmux-setup)"
|
||||||
|
# Setup auto login serial console
|
||||||
|
RUN sudo sed -i "s|ExecStart=.*|ExecStart=-/sbin/agetty --autologin ${USER} --keep-baud 115200,38400,9600 \%I \$TERM|" /usr/lib/systemd/system/serial-getty@.service
|
||||||
```
|
```
|
||||||
|
|
||||||
*00-netconf.yaml*
|
*00-netconf.yaml*
|
||||||
@ -82,6 +86,7 @@ Run it using *libvirt's virt-install*:
|
|||||||
```bash
|
```bash
|
||||||
virt-install --name workstation --disk $OUTPUT --import --memory 4096 --vcpus 4 --nographics --cpu host --channel unix,target.type=virtio,target.name='org.qemu.guest_agent.0'
|
virt-install --name workstation --disk $OUTPUT --import --memory 4096 --vcpus 4 --nographics --cpu host --channel unix,target.type=virtio,target.name='org.qemu.guest_agent.0'
|
||||||
```
|
```
|
||||||
|
... you should be automatically logged in with a **oh-my-zsh** shell
|
||||||
|
|
||||||
From an other terminal you should be able to find the VM ip address using:
|
From an other terminal you should be able to find the VM ip address using:
|
||||||
```bash
|
```bash
|
||||||
|
@ -3,17 +3,15 @@ FROM {{ .Image }}
|
|||||||
USER root
|
USER root
|
||||||
|
|
||||||
RUN apt-get update -y && \
|
RUN apt-get update -y && \
|
||||||
apt-get -y install \
|
DEBIAN_FRONTEND=noninteractive apt-get -y install --no-install-recommends \
|
||||||
linux-image-virtual
|
linux-image-virtual \
|
||||||
|
initramfs-tools \
|
||||||
|
systemd-sysv \
|
||||||
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
|
systemd \
|
||||||
systemd-sysv \
|
dbus \
|
||||||
systemd \
|
udhcpc \
|
||||||
dbus \
|
iproute2 \
|
||||||
udhcpc \
|
iputils-ping
|
||||||
iproute2 \
|
|
||||||
iputils-ping
|
|
||||||
|
|
||||||
RUN systemctl preset-all
|
RUN systemctl preset-all
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user