Skip to content

Instantly share code, notes, and snippets.

@AnthonyGiorgio
Last active November 30, 2021 19:15
Show Gist options
  • Save AnthonyGiorgio/ed80994ac65ab66b674c26263abac115 to your computer and use it in GitHub Desktop.
Save AnthonyGiorgio/ed80994ac65ab66b674c26263abac115 to your computer and use it in GitHub Desktop.
Dockerfile for zCX development container
# Dockerfile for zCX "dev" container.
#
# This container is useful for performing development and test activities
# within a zCX instance.
#
# Copyright 2018-2021 IBM Corp.
FROM ubuntu:21.10
ARG DEBIAN_FRONTEND=noninteractive
LABEL name="dev-container"
LABEL maintainer="Anthony Giorgio <agiorgio@us.ibm.com>"
# Setup apt sources for updates.
RUN echo "deb http://ports.ubuntu.com/ubuntu-ports/ impish main restricted universe multiverse" | cat > /etc/apt/sources.list
RUN echo "deb http://ports.ubuntu.com/ubuntu-ports/ impish-updates main restricted universe multiverse" | cat >> /etc/apt/sources.list
# Install useful development and test utilities.
RUN apt-get update
RUN apt-get install -y openssh-server sudo curl iptables libdevmapper1.02.1 libltdl7 docker.io
RUN apt-get install -y build-essential vim git stress-ng screen ncftp make sshpass software-properties-common
RUN apt-get install -y libgmp-dev libmpfr-dev libmpc-dev texinfo htop rsync wget binutils
# Install more recent gcc version.
RUN add-apt-repository -y ppa:ubuntu-toolchain-r/test
RUN apt-get update
RUN apt-get install -y gcc-10
RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 90
# Upgrade all packages to the latest versions.
RUN apt-get upgrade -y
# Create the directory to run sshd.
RUN mkdir /var/run/sshd
# Set root user password.
RUN echo 'root:passw0rd' | chpasswd
# Let root user login remotely with a password. Horridly insecure, but fine for a test container.
RUN sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
# SSH login fix. Otherwise user is kicked off after login.
RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd
ENV NOTVISIBLE "in users profile"
RUN echo "export VISIBLE=now" >> /etc/profile
RUN rm -rf /var/lib/apt/lists/*
# Start sshd after container comes up.
EXPOSE 22
CMD ["/usr/sbin/sshd", "-D"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment