User Tools

Site Tools



Docker, The Linux container engine is an open source project to pack, ship and run any application as a lightweight container.

Have look at Docker getting started.


kernel with USER_NS, USER_NET, etc.

Setup Cgroups

Easiest way is to install libcgroup package and enable all cgroup types:

# install libcgroup and enable mounts
poldek -u --noask libcgroup
sed -i -e '/^#mount/,$ s/^#//' /etc/cgconfig.conf
service cgconfig start 

Network Configuration

IPv4 packet forwarding is disabled by default in PLD Linux, so internet access from inside the container will not work unless net.ipv4.ip_forward is enabled:

 WARNING: IPv4 forwarding is disabled.

To fix, run:

 sudo sysctl -w net.ipv4.ip_forward=1

Or, to enable it more permanently, enable it on the host's /etc/sysctl.conf:



Don't run docker as root. Add your user to docker group in host to be able to run from your own user.

By adding yourself to the docker group you are effectively granting yourself full root permissions. For more information please read On Docker security: docker group considered harmful.

Whoever, we still consider that more secure approach than just running as root. Accidental damage to Host system is minimized this way.

How To


Getting rid of stopped containers

docker ps -f status=exited
docker ps -q -f status=exited | xargs -r docker rm

Getting rid of unused images

docker images --filter dangling=true
docker images --filter dangling=true --quiet | xargs -r docker rmi

Getting rid of unused volumes

docker volume ls -f dangling=true
docker volume ls -qf dangling=true | xargs -r docker volume rm

For Docker < 1.9, see docker-cleanup-volumes tool.

PLD Base image

Simple script to create new base image for pld:
set -e
# to clean up:
docker rmi $IMAGE
# build
rpm -r $ROOTFS --initdb
install -d $ROOTFS/dev/pts
mknod $ROOTFS/dev/random c 1 8 -m 644
mknod $ROOTFS/dev/urandom c 1 9 -m 644
mknod $ROOTFS/dev/full c 1 7 -m 666
mknod $ROOTFS/dev/null c 1 3 -m 666
mknod $ROOTFS/dev/zero c 1 5 -m 666
mknod $ROOTFS/dev/console c 5 1 -m 660
poldek -r $ROOTFS --up -u bash iproute2 coreutils poldek
# cleanups
PKGS="cracklib-dicts ca-certificates"
for pkg in $PKGS; do
    rpm -r $ROOTFS -q $pkg && rpm -r $ROOTFS -e $pkg --nodeps
# and import
tar -C $ROOTFS -cf- . | docker import - $IMAGE
# and test
docker run -i -u root $IMAGE /bin/echo Success.
# sh -x /vagrant/ 
+ rpm -r /home/vagrant/root --initdb
+ poldek -r root --up -u bash iproute2
+ docker import - pld
# docker run -i -t pld bash
WARNING: IPv4 forwarding is disabled.
[root@e8d2bb1215c2 /]# id
uid=0(root) gid=0(root) groups=0(root)

You can see more available samples in docker/contrib/.

also, you can try glen's pld test image:

vagrant@pld64 ~$ sudo docker run -i -t glen/pld bash
root@ae0aac5de155 ~# 


To play around inside vagrant, create Vagrantfile and run vagrant up followed by vagrant ssh:

mkdir test
cd test
# use curl or wget
curl -sS > Vagrantfile || \
wget -q -O Vagrantfile
vagrant up
vagrant ssh
# -*- mode: ruby -*-
# vi: set ft=ruby :
BOX_NAME = ENV['BOX_NAME'] || "pld64"
BOX_URI = ENV['BOX_URI'] || ""
hostname = File.basename(File.dirname(__FILE__))
print "\033k#{hostname}\033\\" do |config|
  # Setup virtual machine box. This VM configuration code is always executed. = BOX_NAME
  config.vm.box_url = BOX_URI
  # Provision docker and new kernel if deployment was not done
  if Dir.glob("#{File.dirname(__FILE__)}/.vagrant/machines/default/*/id").empty?
    pkg_cmd = "set -xe; "
    # install libcgroup and enable mounts
    pkg_cmd << "poldek -u --noask libcgroup; "
    pkg_cmd << "sed -i -e '/^#mount/,$ s/^#//' /etc/cgconfig.conf; "
    pkg_cmd << "service cgconfig start; "
    # ensure ip forward is enabled
    pkg_cmd << "sed -i -e '/^net.ipv4.ip_forward/ s/0/1/' /etc/sysctl.conf; "
    pkg_cmd << "sysctl -p; "
    # Add docker package and start it
    pkg_cmd << "poldek -u --noask lxc-docker; "
    pkg_cmd << "service lxc-docker start; "
    pkg_cmd << "usermod -A docker vagrant; "
    # Add glibc locales
    pkg_cmd << "poldek -u glibc-localedb-all; "
    # Make some more space for containers
    pkg_cmd << "poldek -u xfsprogs; ldconfig; "
    pkg_cmd << "lvextend --size=+3G /dev/sys/rootfs; xfs_growfs /; "
    config.vm.provision :shell, :inline => pkg_cmd
# Providers were added on Vagrant >= 1.1.0
Vagrant::VERSION >= "1.1.0" and Vagrant.configure("2") do |config|
  config.vm.provider :virtualbox do |vb| = BOX_NAME
    config.vm.box_url = BOX_URI
    # ssh agent forwarding can be useful
    #config.ssh.forward_agent = true
    # Make VM accessible outside VM itself, and use eth1 device :public_network, { bridge: 'eth1', auto_config: true }
packages/docker.txt · Last modified: 2016-06-18 11:27 by glen