Skip to content

Writing a container in a few lines of Go code, as seen at DockerCon 2017 and on O'Reilly Safari.

License

Notifications You must be signed in to change notification settings

madrisan/containers-from-scratch

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Containers from scratch

Go Container

Writing a container in a few lines of Go code, as seen at DockerCon 2017 and on O'Reilly Safari.

Note that the Go code uses some syscall definitions that are only available when building with GOOS=linux.

Usage

Create a chroot environment:

podman run -d --rm --name alpine_3 docker.io/library/alpine:3.14 sleep 1000
podman export alpine_3 -o /tmp/alpine_3.tar
podman stop alpine_3
mkdir alpinefs
tar xf /tmp/alpine_3.tar -C alpine

Now run the Go code:

go build -o container
./container run /bin/sh

About

Writing a container in a few lines of Go code, as seen at DockerCon 2017 and on O'Reilly Safari.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%