Public | Automated Build

Last pushed: 5 months ago
Short Description
My nginx docker image
Full Description

My nginx docker image

Run nginx with server-configs-nginx.

Volumes

/certs

/content

Build

  docker build -t my-nginx .

Run

Forward port and 443 to host.

  docker run -d \
        -v /my/content:/content:ro \
        -v /my/certs:/certs:ro \
        -p 80:80 \
        -p 443:443 \
        --name nginx \
        my-nginx

Or use the host's network stack.

  docker run -d \
        -v /my/content:/content:ro \
        -v /my/certs:/certs:ro \
        --network host \
        --name nginx \
        my-nginx

Run and access shell in the container.

  docker run -it --rm my-nginx /bin/sh

SSL certs for testing

In Keychain Access

  1. Create CA if not already done so
  2. Create a certificate signing request
  3. Create the certificate as CA using the certificate signing request
  4. Export the certificate as .p12 format

Convert the .p12 file to .crt and .key files (see https://gist.github.com/ericharth/8334664)

SSL certs for production

Use certbot

  docker run -it \
        -v /my/certs:/etc/letsencrypt \
        --name certbot
        certbot/certbot certonly --manual

Then start again later

  docker start -i certbot
Docker Pull Command
Owner
ziyu
Source Repository