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.

Revisions

  1. @gesellix gesellix revised this gist Apr 21, 2016. 2 changed files with 9 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions create-certs.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    #!/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"
    6 changes: 6 additions & 0 deletions docker-for-mac-add-certificates.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,12 @@
    see [https://forums.docker.com/t/adding-self-signed-certificates/9761](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`





  2. @gesellix gesellix revised this gist Apr 21, 2016. 1 changed file with 6 additions and 8 deletions.
    14 changes: 6 additions & 8 deletions docker-for-mac-add-certificates.md
    Original file line number Diff line number Diff line change
    @@ -1,8 +1,6 @@
    # log into the vm user root, no password
    screen ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/tty
    # copy certificates from host into the vm (/Users is mounted)
    cp /Users/username/.../cert.* /tmp
    # configure daemon to use the certificates
    # ...
    # reload dameon
    # service docker restart
    see [https://forums.docker.com/t/adding-self-signed-certificates/9761](https://forums.docker.com/t/adding-self-signed-certificates/9761).

    - 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`
  3. @gesellix gesellix created this gist Apr 21, 2016.
    8 changes: 8 additions & 0 deletions docker-for-mac-add-certificates.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    # log into the vm user root, no password
    screen ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/tty
    # copy certificates from host into the vm (/Users is mounted)
    cp /Users/username/.../cert.* /tmp
    # configure daemon to use the certificates
    # ...
    # reload dameon
    # service docker restart