How To Run Docker in

How to run Docker in

Lately we have received a lot of requests asking how to run Docker in This post shows you a few ways to setup a Docker daemon, and launch Docker containers inside of a Hyper container.

Ubuntu 16.04

$ ID=`hyper run -d ubuntu:16.04`                    # launch an Ubuntu container
$ hyper exec -it ${ID} /bin/bash                    # get shell access
# apt-get update                                    
# apt-get install cgroup-lite screen -y   # install dependencies
# cgroups-mount                                     # mount cgroup
# screen -dmS docker_daemon dockerd -D              # Do NOT use `service docker start`
# docker info                                       # if this works, you are all set

CentOS 7.0

$ ID=`hyper run -d centos:7`
$ hyper exec -it ${ID} /bin/bash
# yum install libcgroup e2fsprogs iptables screen docker -y
# mkdir -p /cgroup/memory && mount -t cgroup -o rw,nosuid,nodev,noexec,relatime,memory cgroup /cgroup/memory
# mkdir -p /cgroup/cpuset && mount -t cgroup -o rw,nosuid,nodev,noexec,relatime,cpuset cgroup /cgroup/cpuset
# mkdir -p /cgroup/cpu,cpuacct && mount -t cgroup -o rw,nosuid,nodev,noexec,relatime,cpu,cpuacct cgroup /cgroup/cpu,cpuacct
# mkdir -p /cgroup/net_cls,net_prio && mount -t cgroup -o rw,nosuid,nodev,noexec,relatime,net_cls,net_prio cgroup /cgroup/net_cls,net_prio
# mkdir -p /cgroup/blkio && mount -t cgroup -o rw,nosuid,nodev,noexec,relatime,blkio cgroup /cgroup/blkio
# mkdir -p /cgroup/freezer && mount -t cgroup -o rw,nosuid,nodev,noexec,relatime,freezer cgroup /cgroup/freezer
# mkdir -p /cgroup/perf_event && mount -t cgroup -o rw,nosuid,nodev,noexec,relatime,perf_event cgroup /cgroup/perf_event
# mkdir -p /cgroup/devices && mount -t cgroup -o rw,nosuid,nodev,noexec,relatime,devices cgroup /cgroup/devices
# mkdir -p /cgroup/pids && mount -t cgroup -o rw,nosuid,nodev,noexec,relatime,pids cgroup /cgroup/pids
# screen -dmS docker_daemon /usr/bin/dockerd-current \
          --add-runtime docker-runc=/usr/libexec/docker/docker-runc-current \
          --default-runtime=docker-runc \
# docker info

Prebaked Docker Images!

Prefer to use something prebaked? Check out our repository on Docker hub:

You can use the following tags: - hyperhq/docker-in-hyper:ubuntu-16.04 - hyperhq/docker-in-hyper:centos7 (latest)


$ hyper run -d -P hyperhq/docker-in-hyper
$ hyper ps
CONTAINER ID        IMAGE                          COMMAND                  CREATED             STATUS              PORTS                                      NAMES                   PUBLIC IP
8dcb2ab017eb        hyperhq/docker-in-hyper   "/ /bin/"   1 minutes ago       Up 1 minutes>2375/tcp                     clever-shirley
$ hyper exec -it 8dcb2ab01 /bin/bash
[root@8dcb2ab017eb /]# docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES


Feel free to drop us an email, or use the forum, Twitter or in the console support window!