Skip to content

coderlambda/container

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

container

to study how to build a container step by step

container basics

To build a container you should know following things:

namespace

man 7 namespace

A namespace wraps a global system resource in an abstraction that makes it appear to the processes within the namespace that they have their own isolated instance of the global resource. Changes to the global resource are visible to other processes that are members of the namespace, but are invisible to other processes. One use of namespaces is to implement containers.

The releated systemcalls are not releated in go, so if you want to build a container, you need wrap the syscall youself.

e.g setns, see src/go/system/setns_linux.go (copy from docker)

or easily use the c function, see src/go/simplest_container.go

References:

cgroup

To be continued

aufs

To be continued

network

The simplest way to manage network interface is using ip command. But you may want to use netlink APIs insted.

Here is some infomation about netlink API:

Basics:

If you fallowing the articles up, sometimes you will get an empty list, it's because the change of the netlink API.

Here is the key change:

There is an example code in the src named "getLinkList.c".It tested on 3.13.0-32-generic

About

to study how to build a container step by step

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors