Giter VIP home page Giter VIP logo

docker-haproxy's Introduction

Docker HAProxy

Circle CI

Docker HAProxy image is built on top of Alpine Linux micro OS with the final image size of 6.37 MB vs. 97.89 MB compared to the official haproxy:latest. Allows to run haproxy with multiple configuration files if you prefer to keep things neat and separate.

Running

Pull or build the image yourself and run it. Before you do that you'll need to get the configuration ready. Probably the most useful documentation on how to do that is at cbonte.github.io/haproxy-dconv with a few examples available inside the /configuration folder. Configuration can be passed either via a mounted volume or baked right into the image during the build.

# Prepare configuration, you can use multiple files or a single file.

cat <<-EOL > '/configuration/defaults.cfg'
	defaults
	    mode tcp
	    timeout connect 5s
	    timeout client 1m
	    timeout server 1m
EOL

cat <<-EOL > '/configuration/git.cfg'
	frontend http
	    bind *:80
	    default_backend app

	backend app
	    balance roundrobin
	    server node01 github.com:80
	    server node02 bitbucket.com:80
EOL

# Build…
docker build -t ianbytchek/haproxy .

# Or pull…
docker pull ianbytchek/haproxy

# Run, configuration MUST be provided via a mounted volume.
docker run \
    --detach \
    --name 'haproxy' \
    --publish '80:80' \
    --publish '443:443' \
    --volume '/configuration:/etc/haproxy' \
    ianbytchek/haproxy

Configuration

One thing to keep in mind, the container will first check if there's a haproxy.cfg file in /etc/haproxy and use that, even if there are other configuration files – that's in case when you want to use multiple configuration files. So, if you do, make sure you don't name any of them haproxy.cfg.

docker-haproxy's People

Contributors

iby avatar

Watchers

 avatar

docker-haproxy's Issues

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.