Skip to content

Latest commit

 

History

History
104 lines (78 loc) · 3.06 KB

Docker.md

File metadata and controls

104 lines (78 loc) · 3.06 KB

Docker

Docker feature

Docker is built on top of runC runtime container and uses daemon

Docker installation Debian based.


sudo groupadd docker
sudo usermod -aG docker $USER
newgrp docker
docker run hello-world

dockerd -log info

Docker troubleshoot

Windows Container

Other containercandidates

building

package main
import (
    "fmt"
    "io/ioutil"
    "net/http"
    "os"
)
func main() {
    resp, err := http.Get("https://google.com")
    check(err)
    body, err := ioutil.ReadAll(resp.Body)
    check(err)
    fmt.Println(len(body))
}
func check(err error) {
    if err != nil {
        fmt.Println(err)
        os.Exit(1)
    }
}


FROM golang:onbuild
FROM golang:latest
RUN mkdir /app
ADD . /app/
WORKDIR /app
RUN go build -o main .
CMD ["/app/main"]

go build -o main .
docker build -t example-scratch -f Dockerfile.scratch .


Dockerfile.scratch
FROM scratch
ADD main /
CMD ["/main"]

CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o main .


update 

FROM scratch
ADD ca-certificates.crt /etc/ssl/certs/
ADD main /
CMD ["/main"]

Podman

Podman dependencies

  • Podman uses crun instead of runc. They rewrite crun in C, as runc is written in go. They expect there is much lower overhead, and it is a lot faster.
  • other podman dependencies include buildah for building images.