Skip to content

Instantly share code, notes, and snippets.

@francescou
Last active July 1, 2017 12:24
Show Gist options
  • Save francescou/9ad531c91adcbfaaa21ff48d5d0c0b7d to your computer and use it in GitHub Desktop.
Save francescou/9ad531c91adcbfaaa21ff48d5d0c0b7d to your computer and use it in GitHub Desktop.
basic auth for docker-compose-ui
foo:$apr1$Iyqpl4tR$jF4.Ryzq8TvpHALI8OohR1

Docker Compose UI security

docker run --rm \
  --volume /var/run/docker.sock:/var/run/docker.sock:ro \
  --name docker-compose-ui \
  --read-only \
  francescou/docker-compose-ui:1.6.0
docker run --rm \
  --publish 8080:80 \
  --volume $(pwd)/.htpasswd:/etc/nginx/.htpasswd:ro \
  --volume $(pwd)/default.conf:/etc/nginx/conf.d/default.conf:ro \
  --tmpfs /var/run/ \
  --tmpfs /var/cache/nginx/ \
  --tmpfs /var/log/nginx/log/ \
  --name nginx \
  --link docker-compose-ui:docker-compose-ui \
  --read-only \
  nginx:1.13-alpine
server {
listen 80;
server_name localhost;
access_log /var/log/nginx/log/host.access.log main;
location / {
limit_except GET {
auth_basic "Docker Compose UI";
# https://www.digitalocean.com/community/tutorials/how-to-set-up-password-authentication-with-nginx-on-ubuntu-14-04#create-the-password-file-using-the-openssl-utilities
auth_basic_user_file /etc/nginx/.htpasswd;
}
proxy_pass http://docker-compose-ui:5000;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment