Docker Centos7+haproxy1.8 on port 80
NickName:SAGAR BHOOSHAN Ask DateTime:2019-07-30T12:05:27

Docker Centos7+haproxy1.8 on port 80

I am building a docker haproxy 1.8 custom image on top of centos 7. I want to open port 80 for the front end but whenever IO start the container, it complains about "cannot bind socket on port 80", however it can bind on 8080 and other which are not is use as usual. I believe it has to do with kernal parameters but I cannot run sysctl in dockerfile which returns "Read-only" file system. docker run has --sysctl commandline but it doesn't have any effect I believe. my Dockerfile is as follows :

FROM centos:7
MAINTAINER "SAGAR"
ADD ["http://www.haproxy.org/download/1.8/src/haproxy-1.8.20.tar.gz", "/tmp/"]
RUN mkdir /etc/haproxy
COPY ["haproxy.cfg", "/etc/haproxy/"]
RUN yum -y update && \
yum -y install wget tar gcc pcre-static pcre-devel make perl zlib-devel openssl-devel systemd-devel make && \
groupadd -r haproxy && \
useradd -g haproxy -d /etc/haproxy -s /sbin/nologin  -c "Haproxy User" haproxy && \
chown -R haproxy:haproxy /etc/haproxy && \
chmod -R 774 /etc/haproxy && \
cd /tmp/ && \
tar -xvzf /tmp/haproxy-1.8.20.tar.gz && \
cd /tmp/haproxy-1.8.20 && \
make TARGET=linux2628 USE_PCRE=1 USE_OPENSSL=1 USE_ZLIB=1 USE_CRYPT_H=1 USE_LIBCRYPT=1 USE_LINUX_TPROXY=1 USE_SYSTEMD=1 USE_THREAD=1 && \
make install && \
ln -s /usr/local/sbin/haproxy /usr/sbin/haproxy && \
yum clean all; 
EXPOSE 80 443 13888 9000
USER haproxy 
CMD ["/usr/sbin/haproxy", "-W", "-f", "/etc/haproxy/haproxy.cfg"] 

My docker run command is :

 docker run -d --name haproxy --privileged -p 80:80 haproxy:80

Copyright Notice:Content Author:「SAGAR BHOOSHAN」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/57264139/docker-centos7haproxy1-8-on-port-80

More about “Docker Centos7+haproxy1.8 on port 80” related questions

bash docker command not found in centos7 after installing docker

I installed docker in centos7 and started docker service. I checked docker service it is running. But when I run docker --version getting error like bash docker command not found. Why?

Show Detail

Running ruby sript with Cron in Centos7 Docker image

I've setup a cron job in my centos7 docker image but its not working crontab -e >> * * * * * ruby myrubyfile.rb This same cron job is working on my actual centos7 machine.

Show Detail

Docker running on Centos7 with a Windows 7 container

Is it possible as the title states to run a Docker container with the HOST being Centos7 and the CONTAINER being Windows 7? I have not had any luck with Google pulling down meaningful results, nor...

Show Detail

Centos7: docker swarm services cannot communicate over Overlay network

I have a swarm with 3 CentOS7 nodes running on openstack. I created an overlay network with docker network create --driver overlay p3net_test Then I create 2 services named "nexus" and "nginx_nex...

Show Detail

Docker container (Windows10, Centos7) ports

I have docker image (from private atomic repository) witch i run as a container in Docker (Windows10) and everything is all right: docker run -d --net siecDocker --ip 172.18.0.22 --name UF -v /opt/

Show Detail

How to build a centos7 docker image with a telnet server?

I'm trying to build a centos7 docker image with telnet server. But I don't know how to enable telnet server in it, because systemctl doesn't work in docker.

Show Detail

Installing docker on centos7: docker-engine-selinux conflicts with docker-selinux-*

I tried installing docker from yum and from the install script on Centos7 and both of them give the same error: Error: docker-engine-selinux conflicts with docker-selinux-1.10.3-44.el7.centos.x86_...

Show Detail

Centos7 docker-py doesn't seem to be installed

I installed Centos7 minimal and then: ansible, docker, pip and using pip I installed docker-py. Versions: - Docker version 1.6.0, build 8aae715/1.6.0 - ansible 1.9.1 - docker_py-1.2.2 Trying...

Show Detail

how to install gcc7 in docker centos7

I am trying to build an docker image based on centos7 FROM centos:centos7 RUN yum -y update RUN yum -y install gcc RUN gcc --version the installed gcc is 4.8: Step 4/4 : RUN gcc --version --...

Show Detail

Cron (and systemd) in centos7 in docker

I want to run cron in a centos7 OS running in docker. When I try and start crond I get: Failed to get D-Bus connection: Operation not permitted Googling shows that that is because systemd is not

Show Detail