#Ubuntu based Hello World container #This is the base OS and version to use FROM ubuntu:15.04 #This is the creator of the Dockerfile MAINTAINER name@someemail.com #Updates the repository #Use RUN commands to run commands against our images that we're building #Every RUN command adds a new layer #Launches container and runs apt-get update and stops container RUN apt-get update #Launches container and runs apt-get install nginx and stops container RUN apt-get install -y nginx #Launches container and runs apt-get install golang and stops container RUN apt-get install -y golang #instead combine multiple RUN commands into one long command #Example CMD ["echo","Hello World"] #Important! Save this file as "Dockerfile" with a capitale "D" only #To Build - run this command and name it helloworld as version 0.1 using the Dockerfile in this current directory #Note: -t is an image tag docker build -t helloworld:0.1 . docker build -t="build1" . #Diving Deeper into Dockerfile #Build cache #Simple web server FROM ubuntu:15.04 RUN apt-get udpate RUN apt-get install -y apache2 RUN apt-get install -y apache2-utils RUN apt-get install -y vim RUn apt-get clean EXPOSE 80 CMD ["apache2ctl", "-D", "FOREGROUND"] #end Dockerfile #build web server docker build -t="webserver" . #view docker images docker images #Run container and map port 80 in docker to 80 on host docker run -d -p 80:80 webserver #Stop webserver docker stop dockername