Skip to content

Instantly share code, notes, and snippets.

@gesellix
Last active December 18, 2023 12:22
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save gesellix/f5e19b247f26ad3157bed225dab40282 to your computer and use it in GitHub Desktop.
Save gesellix/f5e19b247f26ad3157bed225dab40282 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