{Docker}

What do they do? Do we use them? Do we know them?

Lets find out!

# Hey

Containers are not VMs

# Why

...

Containers VMs
OS-level virtualization Hardware-level virtualization
Lightweight, shares OS kernel Heavier, full OS per instance
Efficient resource usage Resource-intensive
Rapid deployment Slower to start

Architecture

# Yall still here

Some basic commands

# Yall still here

docker container ls

docker container ls -a

docker images ls

 

docker pull <image_name>

docker run [options] <image_name>

 

docker start <container_id or container_name>

docker stop <container_id or container_name>

 

docker exec [options] <container_id> <command>

Dockerfile

# Yall still here
# Build Stage
FROM golang:1.19-alpine3.16 AS builder
WORKDIR /app
COPY . .
RUN go build -o main main.go 

# Run Stage
FROM alpine:3.16
WORKDIR /app
COPY --from=builder /app/main .
COPY app.env . 

EXPOSE 8080
CMD [ "/app/main" ]

Commands

# Yall still here

docker build -t quiz .

 

docker run -p 8080:8080 quiz

Docker 101

By Achintya Pranshu

Docker 101

  • 119