I'm trying to create a docker image (centos7) with an nginx web server running on it. I have created a Dockerfile
which looks like this:
FROM centos:centos7
RUN yum update -y
# -------- OPENSSL --------
#ADD install-openssl.sh /
#RUN chmod +x install-openssl.sh
#RUN /install-openssl.sh
# -------- NGINX --------
RUN yum install epel-release -y
RUN yum install nginx -y
# Copy a configuration file from the current directory
ADD nginx.conf /etc/nginx/
# Append "daemon off:" to the beginning of the configuration
RUN echo "daemon off;" >> /etc/nginx/nginx.conf
# Expose ports
EXPOSE 80
RUN systemctl start nginx
I build my docker image with the following command:
docker build -t nginx-img .
And I run it like this:
docker -v run --name nginx-cont -p 80:80 -i nginx-img
But I get the following error:
Failed to get D-Bus connection: Operation not permitted