Docker and Linux
Introductions
- introductions of two to three students
Docker
We will use the Linux Practice homework to show you how to get started with Docker containers.
Linux
-
Quick survey on Linux background for the class:
- 1: Newbie
- 2: Some exposure
- 3: Lots of exposure
- 4: Use it every day
-
Review of the Linux Journey materials.
Dockerfile
- Dockerfile for Alpine Linux and bash:
FROM alpine:latestRUN apk update && apk add bashThen:
docker build -t alpine_linux .docker run -it alpine_linux /bin/bash- Dockerfile used to build the image for the homework
FROM ubuntu:20.04
# install sshRUN apt update && apt install -y openssh-server# install needed packagesRUN apt install -y less
RUN mkdir /var/run/sshd# Set root password for SSH access (change 'your_password' to your desired password)RUN echo 'root:tolkien' | chpasswdRUN sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_configRUN sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' /etc/ssh/sshd_config
# setup bilbo userRUN useradd -m -s /bin/bash bilboRUN echo "bilbo:ring" | chpasswd
EXPOSE 22CMD ["/usr/sbin/sshd", "-D"]Discussion
- How does the command line give you access to basic OS functionality?
- file system
- access control
- processes