Is there any way to enable Kubernetes on Docker for Mac via terminal?

2/18/2019

I'm developing an Electron app and want to distribute the back-end portion of the web application (PHP) via Docker and Kubernetes (using Helm charts). I plan to package the expanded dmg of Docker, but haven't found a way to configure Docker from terminal. Is this possible - enable Kubernetes and increase CPU size and RAM via terminal?

Edit: I don't want to just start Docker from the command line. I want to configure the first installation as well specifying the amount of resources the Docker daemon has access to and enabling Kubernetes.

-- jth_92
docker
docker-for-mac
kubernetes

1 Answer

2/22/2019

After continued research, I did find an answer to this. On Docker for Mac, the Docker daemon is actually run inside of Hyperkit VM and the Docker CLI just communicates with the Docker engine running in Hyperkit. The configuration for this is at ~/Library/Group Containers/group.com.docker/settings.json.

{
  "proxyHttpMode" : "system",
  "diskPath" : "~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/Docker.qcow2",
  "diskSizeMiB" : 65536,
  "cpus" : 5,
  "defaultMachineMigrationStatus" : 4,
  "memoryMiB" : 9216,
  "displayedWelcomeWhale" : true,
  "buildNumber" : "26764",
  "autoStart" : true,
  "kubernetesInitialInstallPerformed" : true,
  "channelID" : "stable",
  "checkForUpdates" : true,
  "settingsVersion" : 1,
  "kubernetesEnabled" : true,
  "version" : "18.06.1-ce-mac73",
  "displayedWelcomeMessage" : true,
  "analyticsEnabled" : true,
  "linuxDaemonConfigCreationDate" : "2017-10-24 15:59:40 +0000",
  "dockerAppLaunchPath" : "/Applications/Docker.app"
}

When Docker starts up, it will allocate these settings to hyperkit as command line arguments: com.docker.hyperkit -A -u -F vms/0/hyperkit.pid -c 5 -m 9216M.

By default, when running docker containers, docker will allocate all memory and CPU of hyperkit for them to consume but can be overridden by docker run arguments.

-- jth_92
Source: StackOverflow