GithubHelp home page GithubHelp logo

kmiladi / docker-hostmanager Goto Github PK

View Code? Open in Web Editor NEW

This project forked from guillemcanal/docker-hostmanager

0.0 2.0 0.0 136 KB

Access your Docker containers using domain names either with HTTP or HTTPS

PHP 98.57% Dockerfile 0.62% Shell 0.81%

docker-hostmanager's Introduction

Docker HostManager

Build Status codecov quality smells

Access your Docker containers using domain names either with HTTP or HTTPS.

The Docker HostManager update your hosts file and generate TLS certificates
when a container gets created with just a couple of labels.

Run

Linux

# Run the docker manager
docker run --detach -t --name docker-hostmanager \
--restart always \
--volume docker-hostmanager-data:/data:rw \
--volume /etc/hosts:/host/etc/hosts:rw \
--volume /var/run/docker.sock:/var/run/docker.sock:ro \
gcanal/docker-hostmanager:latest

Mac

# Make your /etc/hosts/ writable
sudo chmod 777 /etc/hosts

# Run the docker manager
docker run --detach -t --name docker-hostmanager \
--restart always \
--volume docker-hostmanager-data:/data:rw \
--volume /private/etc/hosts:/host/etc/hosts:rw \
--volume /var/run/docker.sock:/var/run/docker.sock:ro \
gcanal/docker-hostmanager:latest

Windows

No tested yet, to be documented.

Install the root certificate

In order to access your domains using HTTPS, you will need to add the Root Certificate generated by DockerHostManager
in your browsers and in your trusted root certification authorities.

# Copy the certificate from a docker volume anywhere on your host machine
docker cp docker-hostmanager:/data/root-ca.crt .

Note: if you are using Firefox, you will need to add your certificate using the following method :

  1. Open Preferences
  2. On the top right corner, search: certificates
  3. Click on View Certificates...
  4. Click on the Authorities tab
  5. Click on Import...
  6. Add your root-ca.crt
  7. Tick the box Trust this CA to identify websites.
  8. Click on Ok

Linux (Ubuntu, Debian)

sudo cp root-ca.crt /usr/local/share/ca-certificates/
sudo update-ca-certificates --fresh

Mac

sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain ~/root-ca.crt

Windows

certutil -addstore -f "ROOT" root-ca.crt

Usage example

docker run --rm -t \
--label 'traefik.enable=true' \
--label 'traefik.port=80' \
--label 'traefik.backend=demo' \
--label 'traefik.frontend.rule=Host: nginx.docker' \
nginx:alpine

Head to http://nginx.docker or https://nginx.docker

docker-hostmanager's People

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.