Add ssh to kic image

pull/6390/head
Medya Gh 2020-01-23 18:24:51 -08:00
parent 773510b9c1
commit 1e05b11703
2 changed files with 16 additions and 6 deletions

View File

@ -1,13 +1,21 @@
ARG COMMIT_SHA
# using node image created by kind https://github.com/kubernetes-sigs/kind
# could be changed to ubuntu.
# for now using node image created by kind https://github.com/kubernetes-sigs/kind
# could be changed to slim ubuntu with systemd.
FROM kindest/node:v1.16.2
USER root
RUN apt-get update && apt-get install -y \
sudo \
dnsutils \
openssh-server \
&& apt-get clean -y
# Deleting all kind related stuff from the image.
# based on https://github.com/rastasheep/ubuntu-sshd/blob/master/18.04/Dockerfile
# making SSH work for docker container
RUN mkdir /var/run/sshd
RUN echo 'root:root' |chpasswd
RUN sed -ri 's/^#?PermitRootLogin\s+.*/PermitRootLogin yes/' /etc/ssh/sshd_config
RUN sed -ri 's/UsePAM yes/#UsePAM yes/g' /etc/ssh/sshd_config
EXPOSE 22
# Deleting all "kind" related stuff from the image.
RUN rm -rf \
/var/cache/debconf/* \
/var/lib/apt/lists/* \
@ -20,7 +28,9 @@ RUN rm -rf \
/kind/bin/kubeadm /kind/bin/kubelet /kind/systemd /kind/images /kind/manifests
RUN echo "kic! Build: ${COMMIT_SHA} Time :$(date)" > "/kic.txt"
# for minikube ssh. to match VM using docker username
RUN useradd -ms /bin/bash docker
RUN adduser --disabled-password --gecos '' docker
RUN adduser docker sudo
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
USER docker
RUN mkdir /home/docker/.ssh
USER root

View File

@ -41,7 +41,7 @@ const DefaultBindIPV4 = "127.0.0.1"
// BaseImage is the base image is used to spin up kic containers created by kind.
// const BaseImage = "gcr.io/k8s-minikube/kicbase:v0.0.1@sha256:c4ad2938877d2ae0d5b7248a5e7182ff58c0603165c3bedfe9d503e2d380a0db"
// BaseImage is the base image is used to spin up kic containers created by kind.
const BaseImage = "gcr.io/k8s-minikube/kicbase:v0.0.2-snapshot"
const BaseImage = "kicbase:local"
// OverlayImage is the cni plugin used for overlay image, created by kind.
const OverlayImage = "kindest/kindnetd:0.5.3"