Securing a Docker container with HTTP BASIC AUTH
Consider running a Docker container with a web application exposing a certain port. How to apply the additional security layer before accessing the URL (HTTP BASIC AUTH)?
Docker Engine version >= 1.9.1
One Solution collect form web for “Securing a Docker container with HTTP BASIC AUTH”
Typically, you dedicate a container for authentication, with for instance NGiNX.
This is described in “Authenticating proxy with nginx”, which not only adds the basic authentication, but also ssl (https)
That web server will then reverse proxy to your container.
You have a more generic solution (based on a reverse-proxy NGiNX) with
nginx-proxy sets up a container running nginx and
docker-gengenerates reverse proxy configs for nginx and reloads nginx when containers are started and stopped.
See the use case with “Automated Nginx Reverse Proxy for Docker”.