Container Images

Lab setup data from the Pluralsight course on:

Managing Container Images


The Complete Obsolete Guide to Generative AI (from Manning) is a lighthearted look at programming with AI, as well as a rock-solid resource for getting the most out of these insanely powerful services. Let it be your guide to analyzing massive data sources, summarize pages and pages of text, and scour the live internet.

 


A Simple Dockerfile

# Dockerfile contents:
FROM ubuntu:24.04
ENV DEBIAN_FRONTEND="noninteractive" TZ="America/Toronto"
RUN apt-get update
RUN apt-get install -y apache2
ADD index.html /var/www/html/
CMD /usr/sbin/apache2ctl -D FOREGROUND
EXPOSE 80

Many Line Dockerfile

# dockerfile manyline:
FROM ubuntu:16.04
RUN apt-get update && apt-get install -y curl 
RUN mkdir -p /opt/jboss/wildfly 
RUN cd /tmp 
RUN curl -O https://download.jboss.org/wildfly/10.1.0.Final/wildfly-10.1.0.Final.tar.gz 
RUN tar xf wildfly-10.1.0.Final.tar.gz 
RUN mv wildfly-10.1.0.Final /opt/jboss/wildfly 
RUN rm wildfly-10.1.0.Final.tar.gz

One Line Dockerfile

# dockerfile oneline:
FROM ubuntu:16.04
RUN apt-get update && apt-get install -y curl 
RUN mkdir -p /opt/jboss/wildfly && cd /tmp && \
curl -O https://download.jboss.org/wildfly/10.1.0.Final/wildfly-10.1.0.Final.tar.gz \
&& tar xf wildfly-10.1.0.Final.tar.gz \
&& mv wildfly-10.1.0.Final /opt/jboss/wildfly \
&& rm wildfly-10.1.0.Final.tar.gz

Launch Docker Registry With Persistent Storage

docker run -d \
-p 5000:5000 \
--restart always \
-v /var/images:/var/lib/registry \
registry:latest

Set Up User Authentication for a Docker Registry

docker run --entrypoint /bin/sh \
    -v /home/ubuntu/auth:/auth registry:2 \
    -c "apk add --no-cache apache2-utils \
    && htpasswd -Bbn your_username your_password \
    > /auth/htpasswd_file"

docker run -d -p 5000:5000 \
  --restart=no \
  --name registry1 \
  -v `pwd`/auth:/auth \
  -e "REGISTRY_AUTH=htpasswd" \
  -e "REGISTRY_AUTH_HTPASSWD_REALM=.basic-realm" \
  -e "REGISTRY_AUTH_HTPASSWD_PATH=/auth/htpasswd_file" \
  -v /certs:/certs \
  -e REGISTRY_HTTP_TLS_CERTIFICATE=/certs/domain.crt \
  -e REGISTRY_HTTP_TLS_KEY=/certs/domain.key \
  registry:2
  webserver-config.yaml

apiVersion: apps/v1
kind: Deployment
metadata:
  name: webserver
spec:
  replicas: 1
  selector:
    matchLabels:
      app: webserver
  template:
    metadata:
      labels:
        app: webserver
    spec:
      containers:
      - name: mywebserver
        image: dbclinton/webserver:latest
      imagePullSecrets:
      - name: regcred-1