title: Cannot run Kubernetes inside Ubuntu Docker image
body: <p>I want to create a cluster to try Kubernetes locally.</p>
  <p>I could create Virtual machines with Ubuntu on them, or buy some Raspberry Pi but I'd like to know if I can use Docker containers to emulate that).</p>
  <p>My idea is to create a Docker image based on Ubuntu, and install Kubernetes and Docker there.</p>
  <p>Then I can start 4 containers running this image and configure Kubernetes so one of them is Mater and the others are workers (this should simulate 4 computers running Ubuntu with Docker and Kubernetes on them)</p>
  <p>I'm following this tutorial: <a href="https://phoenixnap.com/kb/install-kubernetes-on-ubuntu" rel="nofollow noreferrer">https://phoenixnap.com/kb/install-kubernetes-on-ubuntu</a></p>
  <p>So far I have downloaded the Ubuntu image, installed docker and Kubernetes on it.</p>
  <p>However I cannot start Docker with the command from the tutorial, since the Ubuntu container seems to not have booted with systemd</p>
  <pre><code>systemctl status docker
  
  System has not been booted with systemd as init system (PID 1). Can't operate.
  Failed to connect to bus: Host is down
  </code></pre>
  <p>Without starting Docker if I try to assign one of the Containers as a Kubernetes Master, it fails</p>
  <pre><code>kubeadm init --pod-network-cidr=10.244.0.0/16
  
  [init] Using Kubernetes version: v1.24.3
  [preflight] Running pre-flight checks
          [WARNING Swap]: swap is enabled; production deployments should disable swap unless testing the NodeSwap feature gate of the kubelet
          [WARNING SystemVerification]: missing optional cgroups: blkio
  error execution phase preflight: [preflight] Some fatal errors occurred:
          [ERROR CRI]: container runtime is not running: output: time=&quot;2022-08-16T12:27:18Z&quot; level=fatal msg=&quot;unable to determine runtime API version: rpc error: code = Unavailable desc = connection error: desc = \&quot;transport: Error while dialing dial unix /var/run/containerd/containerd.sock: connect: no such file or directory\&quot;&quot;
  , error: exit status 1
  [preflight] If you know what you are doing, you can make a check non-fatal with `--ignore-preflight-errors=...`
  To see the stack trace of this error execute with --v=5 or higher
  </code></pre>
  <p>Is there a way of taking a Docker image (eg: ubuntu) and make it run Kubernetes on it?</p>
  <p>This is the dockerfile I use to create the image and install Kubernetes and docker</p>
  <pre><code>FROM ubuntu:22.04
  RUN apt-get update -y 
  RUN apt install -y gnupg2 curl software-properties-common docker.io
  RUN curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add
  RUN apt-add-repository &quot;deb http://apt.kubernetes.io/ kubernetes-xenial main&quot;
  RUN apt-get install -y kubeadm kubelet kubectl
  </code></pre>