Navigate back to the homepage

learning docker - day 2

Christos Paschalidis
December 15th, 2020 · 1 min read

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# pseudo
2docker image tag <source:tag> <targetImage:tag>
3
4# actual
5docker 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 there
2FROM debian:jessie
3
4# injecting variables for this dockerfile
5ENV NGINX_VERSION 1.11.10
6
7# executing shell commands
8RUN apt-get update && apt-get install -y --force-yes apache2
9
10# 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 between
15# your computer and a web server.
16# Port 80 is the host port
17
18# now you will still need to use -p or -P to open/forward these ports on the host.
19# here we just exposing them
20EXPOSE 80 443
21
22# Required the final command that will be executed each time you start or rerun an container
23# 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 using
26
27CMD ["nginx", "-g", "deamon:off"]

other useful commands for Dockerifiles

1WORKDIR /usr/share... # this is like `cd`
1COPY <localFileName> <dcokerBoxFileName>

More articles from blog for tech

learning docker - day 1

Docker commands I learned today

December 14th, 2020 · 1 min read

Generate a Github webhook token

what I learned today

November 12th, 2020 · 1 min read
© 2020–2021 blog for tech
Link to $https://github.com/paschalidiLink to $https://www.linkedin.com/in/christos-paschalidis/