Dockerfile:
FROM registry.access.redhat.com/rhel
WORKDIR /usr/src
RUN yum-config-manager --save --setopt=rhel-7-server-rt-beta-rpms.skip_if_unavailable=true
# Install Nginx Repository
RUN yum install -y http://nginx.org/packages/rhel/7/noarch/RPMS/nginx-release-rhel-7-0.el7.ngx.noarch.rpm
# Install
RUN yum install -y nginx
# Clean up YUM
RUN yum clean all
# Disable Nginx to run on background
RUN echo "daemon off;" >> /etc/nginx/nginx.conf
# Expose the HTTP & HTTPS ports
EXPOSE 8080
=================================
Docker build
docker build -t nginxt .
=================================
Docker run
docker run -it -p 8080:8080 nginxt
=================================
[root@ip-20-0-0-86 friday]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
7eaaf772b94a nginxt "/bin/bash" About a minute ago Up About a minute 0.0.0.0:8080->8080/tcp elegant_kalam
[root@7eaaf772b94a src]# curl localhost:8080
curl: (7) Failed connect to localhost:8080; Connection refused