commands for image tagging and pushing
login to docker hub
will authenticate you against docker hub
1docker login
shows all the metadata of an image
1docker image inspect
Image tagging and pushing
create a tag for an image
1# pseudo2docker image tag <source:tag> <targetImage:tag>34# actual5docker image tag nginx yourDockerHubUsername:nginx
push image to docker hub
1docker image push <youTaggedImageName>
Dockerfile basics
remember each command (or else line) is its own layer
1# required to be there2FROM debian:jessie34# injecting variables for this dockerfile5ENV NGINX_VERSION 1.11.1067# executing shell commands8RUN apt-get update && apt-get install -y --force-yes apache2910# by default nothing is exported.11# APPARENTLY WEB SERVERS USUALLY EXPORT 80 and 443 ports.12# Port 443 is the standard port for all secured HTTP traffic,13# meaning it’s absolutely essential for most modern web activity.14# Encryption is necessary to protect information, as it makes its way between15# your computer and a web server.16# Port 80 is the host port1718# now you will still need to use -p or -P to open/forward these ports on the host.19# here we just exposing them20EXPOSE 80 4432122# Required the final command that will be executed each time you start or rerun an container23# note that sometimes this command smight be missing on a Dockerfile.24# You might wonder how this is possible when its required.25# This is because the exists in the FROM image you will be using2627CMD ["nginx", "-g", "deamon:off"]
other useful commands for Dockerifiles
1WORKDIR /usr/share... # this is like `cd`
1COPY <localFileName> <dcokerBoxFileName>