Security Note: Mounting the Docker socket (/var/run/docker.sock) can pose security risks. Consider using more secure alternatives in production environments.
For Windows: Edit C:\Windows\System32\drivers\etc\hosts
Add the following line:
1
127.0.0.1 traefik.x.internal
Generate Self-Signed Certificates
Choose one of the following options:
Option 1: Using mkcert (Recommended for Development)
mkcert can solve browser trust issues. Install mkcert, then run:
1 2 3 4 5 6
# directly gen certs at the current dir # mkcert example.com "*.example.com" example.test localhost 127.0.0.1 ::1 # specify the cert output dir mkcert -key-file certs/key.pem -cert-file certs/cert.pem x.internal "*.x.internal" mkcert -install
# When using -x509, default_days in config will be ignored, it is a bug # using -days to workaround openssl req -x509 -new -nodes -days 365 \ -config ssl.cnf \ -keyout certs/key.pem \ -out certs/cert.pem
ssl.cnf like as follows:
Tips: DNS.1, DNS.2, IP.7, DNS.11, the numbers are only required to be unique, and can also be unordered.