1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00
moby--moby/pkg/libcontainer
Michael Crosby e8abaf217b Initial commit of libcontainer
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
2014-02-21 14:56:15 -08:00
..
capabilities Initial commit of libcontainer 2014-02-21 14:56:15 -08:00
cli Initial commit of libcontainer 2014-02-21 14:56:15 -08:00
namespaces Initial commit of libcontainer 2014-02-21 14:56:15 -08:00
network Initial commit of libcontainer 2014-02-21 14:56:15 -08:00
utils Initial commit of libcontainer 2014-02-21 14:56:15 -08:00
container.go Initial commit of libcontainer 2014-02-21 14:56:15 -08:00
container.json Initial commit of libcontainer 2014-02-21 14:56:15 -08:00
errors.go Initial commit of libcontainer 2014-02-21 14:56:15 -08:00
MAINTAINERS Initial commit of libcontainer 2014-02-21 14:56:15 -08:00
privileged.json Initial commit of libcontainer 2014-02-21 14:56:15 -08:00
README.md Initial commit of libcontainer 2014-02-21 14:56:15 -08:00
types.go Initial commit of libcontainer 2014-02-21 14:56:15 -08:00
ubuntu.json Initial commit of libcontainer 2014-02-21 14:56:15 -08:00

libcontainer - reference implementation for containers

playground

Use the cli package to test out functionality

First setup a container configuration. You will need a root fs, better go the path to a stopped docker container and use that.

{
    "id": "koye",
    "namespace_pid": 12265,
    "command": {
        "args": [
            "/bin/bash"
        ],
        "environment": [
            "HOME=/",
            "PATH=PATH=$PATH:/bin:/usr/bin:/sbin:/usr/sbin",
            "container=docker",
            "TERM=xterm"
        ]
    },
    "rootfs": "/root/development/gocode/src/github.com/docker/libcontainer/namespaces/ubuntu",
    "network": null,
    "user": "",
    "working_dir": "",
    "namespaces": [
        "NEWNET",
        "NEWIPC",
        "NEWNS",
        "NEWPID",
        "NEWUTS"
    ],
    "capabilities": [
        "SETPCAP",
        "SYS_MODULE",
        "SYS_RAWIO",
        "SYS_PACCT",
        "SYS_ADMIN",
        "SYS_NICE",
        "SYS_RESOURCE",
        "SYS_TIME",
        "SYS_TTY_CONFIG",
        "MKNOD",
        "AUDIT_WRITE",
        "AUDIT_CONTROL",
        "MAC_OVERRIDE",
        "MAC_ADMIN"
    ]
}

After you have a json file and a rootfs path to use just run: ./cli exec container.json

If you want to attach to an existing namespace just use the same json file with the container still running and do: ./cli execin container.json