Docker/Dockerfiles
From charlesreid1
The Dockerfile is where you define the commands that populate your docker container.
Crafting
The Philosophy
The idea is to have easy to start and easy to stop services that are stateless, and don't "expect" stuff. (Not sure I understand that exactly, but okay.)
Web app stack example: LAMP would implement Apache as one container, MySQL as another, and PHP as another (well, maybe A+P as one.)
Maybe one container for a cache, too.
Keep em clean, keep em modular.
Copy command
Copy command allows you to copy stuff from local host system into the docker image.
Add command works too, but copy less complicated.
https://docs.docker.com/engine/reference/builder/#copy
Finding Dockerfile examples
The dockerfiles used to create various docker images are usually available with the image itself and are usually quite simple. That's the idea, anyway.
For example, here's an uncomplicated Dockerfile for an Stunnel docker container from [1]:
FROM ubuntu RUN apt-get update RUN apt-get -y install stunnel CMD ["stunnel"]
To build custom versions, this dockerfile [2] might be better:
# stunnel Server # # VERSION 0.0.1 # Building from Ubuntu Precise FROM ubuntu:precise MAINTAINER Courtney Couch, courtney@moot.it RUN apt-get update RUN apt-get upgrade -y RUN apt-get -y install build-essential wget RUN apt-get -y install openssl libssl-dev ENV STUNNEL_VERSION 4.56 RUN wget -O - ftp://ftp.stunnel.org/stunnel/archive/4.x/stunnel-$STUNNEL_VERSION.tar.gz | tar -C /usr/local/src -zxv RUN mkdir -p /stunnel VOLUME ["/stunnel"] ADD stunnel.conf /stunnel/stunnel.conf ADD stunnel.pem /stunnel/stunnel.pem # Build stunnel RUN cd /usr/local/src/stunnel-$STUNNEL_VERSION && ./configure && make && make install EXPOSE 443 CMD ["/usr/local/bin/stunnel", "/stunnel/stunnel.conf"]