We learnt docker so we can create better docker images using dockerfile?
What is dockerfile?
- a file
- contains instructions
- for writing each layer
- multiple layers == one image
Rule of dockerfile?
- each line ==== one layer
- Each layer would be created from a container from the previous layer
Example of Dockerfile
FROM ubuntu
MAINTAINER Rajesh Kumar <rajesh@devopsschool.com?
RUN apt-get update
RUN apt-get install git -y
COPY index.html /opt
FROM ubuntu
MAINTAINER Rajesh Kumar <rajesh@devopsschool.com?
RUN apt-get update
RUN apt-get install git -y
COPY index.html /opt
FROM httpd
MAINTAINER Rajesh Kumar <rajesh@devopsschool.com?
RUN apt-get update
RUN apt-get install git -y
COPY index.html /opt
15 mkdir dock-image
16 cd dock-image/
17 clear
18 vi dockerfile
19 touch index.html
20 docker build -t ub-up-git .
21 docker images
Lab & Excercise
- https://devopsschool.com/tutorial/docker/dockerfile/dockerfile-example-sample-lab.html
Example of App Dockerfile
# https://github.com/jenkinsci/docker/blob/587b2856cd225bb152c4abeeaaa24934c75aa460/Dockerfile
# https://github.com/tianon/docker-brew-ubuntu-core/blob/50b110c15148c069706b155a60d21ecfcbb59de9/focal/Dockerfile
# https://github.com/docker-library/httpd/blob/6d68525ac47c0474d3d74269b2669104c1d867dd/2.4/Dockerfile
How to set PID1 for the image?
- CMD or ENTRYPOINT
Reference
- https://devopsschool.com/tutorial/docker/commands/index.html
- $ docker help
Docker Advance Tutorial | Part 1 out 16 | — By DevOpsSchool
Docker Advance Tutorial | Part 2 out 16 | — By DevOpsSchool
Docker Advance Tutorial | Part 3 out 16 | — By DevOpsSchool
Docker Advance Tutorial | Part 4 out 16 | — By DevOpsSchool
Docker Advance Tutorial | Part 5 out 16 | — By DevOpsSchool
Docker Advance Tutorial | Part 6 out 16 | — By DevOpsSchool
Docker Advance Tutorial | Part 7 out 16 | — By DevOpsSchool
Docker Advance Tutorial | Part 8 out 16 | — By DevOpsSchool
Docker Advance Tutorial | Part 9 out 16 | — By DevOpsSchool
Docker Advance Tutorial | Part 10 out 16 | — By DevOpsSchool
Docker Advance Tutorial | Part 11 out 16 | — By DevOpsSchool
Docker Advance Tutorial | Part 13 out 16 | — By DevOpsSchool
Docker Advance Tutorial | Part 14 out 16 | — By DevOpsSchool
Docker Advance Tutorial | Part 15 out 16 | — By DevOpsSchool
Docker Advance Tutorial | Part 16 out 16 | — By DevOpsSchool
Latest posts by Rajesh Kumar (see all)
- Best AI tools for Software Engineers - November 4, 2024
- Installing Jupyter: Get up and running on your computer - November 2, 2024
- An Introduction of SymOps by SymOps.com - October 30, 2024