Skip to content

Instantly share code, notes, and snippets.

@pan-rui
Forked from gesellix/create-certs.sh
Created December 18, 2023 12:22
Show Gist options
  • Select an option

  • Save pan-rui/6e735eb193ba22de4be2aef71daaf85c to your computer and use it in GitHub Desktop.

Select an option

Save pan-rui/6e735eb193ba22de4be2aef71daaf85c 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
@pan-rui
Copy link
Author

pan-rui commented Dec 18, 2023

add

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment