# spec/Dockerfile_spec.rb
require "serverspec"
require "docker"
describe "Dockerfile" do
before(:all) do
image = Docker::Image.build_from_dir('.')
set :os, family: :debian
set :backend, :docker
set :docker_image, image.id
end
it "installs the right version of Ubuntu" do
expect(os_version).to include("Ubuntu 14")
end
def os_version
command("lsb_release -a").stdout
end
end
{
"defaultAction": "SCMP_ACT_ERRNO",
"architectures": [
"SCMP_ARCH_X86_64",
"SCMP_ARCH_X86",
"SCMP_ARCH_X32"
],
"syscalls": [
{
"name": "accept",
"action": "SCMP_ACT_ALLOW",
"args": []
},
{
"name": "accept4",
"action": "SCMP_ACT_ALLOW",
"args": []
},
...
]
}
$ docker run --rm -it --security-opt seccomp=/path/to/seccomp/profile.json hello-world
docker run --cap-drop ALL --cap-add SYS_TIME ntpd /bin/sh
Defaults:
CHOWN, DAC_OVERRIDE, FSETID, FOWNER, MKNOD,
NET_RAW, SETGID, SETUID, SETFCAP, SETPCAP,
NET_BIND_SERVICE, SYS_CHROOT, KILL, AUDIT_WRITE
# Create a user called "dockremap"
$ sudo adduser dockremap
# Setup subuid and subgid
$ sudo sh -c 'echo dockremap:500000:65536 > /etc/subuid'
$ sudo sh -c 'echo dockremap:500000:65536 > /etc/subgid'
$ sudo vim /etc/init.d/docker
:
:
/usr/local/bin/docker daemon --userns-remap=default
$ docker run -d \
--name='low_prio' \
--cpuset-cpus=0 \
--cpu-shares=20 \
busybox md5sum /dev/urandom
$ docker run -d \
--name='high_prio' \
--cpuset-cpus=0 \
--cpu-shares=80 \
busybox md5sum /dev/urandom
$ docker run --rm -it --security-opt apparmor=docker-default hello-world
organizations which design systems ... are constrained to produce designs which are copies of the communication structures of these organizations
— M. Conway