You are on page 1of 8

Session 3

• Build custom Images


Configuration to define
the container’s behavior

Docker Docker Build


Dockerfile
Client Server Image
Creating a Dockerfile

Specify a base image

Run commands to install


additional programs

Specify a command to run


on container startup
Create an image that runs redis-server

Instruction telling Docker


Server what to do Argument to the instruction

FROM alpine

RUN apk add --update redis

CMD [“redis-server”]
Instructing a computer with no OS
Writing a Dockerfile
and asking it to install Chrome

Install an operating system Specify a base image

Startup your default browser

Navigate to chrome.google.com

Run commands to install


Download installer additional programs

Open file explorer

Execute chrome_installer.exe

Command to run on
Execute chrome.exe startup
• Create Docker Container
Temp Container image
1
2 Image Cache

Temp Image
Alpine Image
From alpine
File system Startup command
RUN apk add --update redis $ apk[“redis-server”]
add –update redis Running
Process snapshot
Temp Container Image bin dev etc
$ ???
home proc Redis
CMD [“redis-server”]
System call to
Temp Container 2 access HDD

Final Image

Kernel

RAM CPU Network


Hard Disk
Hard disk
segment for
Redis this process
• Create Docker Container

From alpine
RUN apk add --update redis
CMD apk
RUN [“redis-server”]
add --update gcc`
• Tagging the Image

Image tag

docker build -t grthilak/redis:latest .

Specifies the directory of


files/folders to use for
the build

You might also like