Skip to content

Instantly share code, notes, and snippets.

@felipeg48
Forked from gesellix/create-certs.sh
Created October 30, 2018 19:02
Show Gist options
  • Save felipeg48/395146836a6c9bf51cafe92642c871f0 to your computer and use it in GitHub Desktop.
Save felipeg48/395146836a6c9bf51cafe92642c871f0 to your computer and use it in GitHub Desktop.
add TLS/self-signed certificates to the Docker for Mac daemon
#!/bin/sh
mkdir -p certs
openssl req -x509 -days 365 -newkey rsa:4096 -nodes -sha256 -out certs/domain.crt -keyout certs/domain.key -subj "/C=DE/ST=Berlin/L=Berlin/O=IT/CN=docker.local"

see https://forums.docker.com/t/adding-self-signed-certificates/9761.

  • create certificates (see create-certs.sh)
  • move the certificates to a directory somewhere in /Users/..... We'll be able to copy files from there into the VM as it will already be mounted by Docker.
  • attach to the TTY: screen ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/tty
  • copy the certificates into the vm: mkdir -p /etc/docker/certs.d/mydomain.com:5000 && cp /Users/.../certs/domain.crt /etc/docker/certs.d/mydomain.com/ca.crt
  • restart Docker: service docker restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment