Centos + apache2 + archivos HTML
Sencillo ejemplo de Dockerfile con Centos, Apache2 y archivos HTML.
FROM centos
LABEL version="1.0.0"
LABEL description="Esto es mi primera web con Docker"
LABEL vendor="yo"
RUN yum install httpd -y
WORKDIR /var/www/html
COPY mi_web .
RUN echo "$(whoami)" > ./user1.html
RUN useradd eduardo
RUN chown eduardo /var/www/html -R
USER eduardo
ENV contenido prueba2
RUN echo "$contenido creado por <b> $(whoami) </b>" > /tmp/prueba.html
USER root
RUN cp /tmp/prueba.html ./prueba.html
COPY run.sh /run.sh
CMD sh /run.sh
Estructura de directorios.
Dockerfile run.sh mi_web |_____ index.html
run.sh
#!/bin/bash
echo "Iniciando container..."
apachectl -DFOREGROUND
index.html
<h1>Mi WEB</h1>
<p>
Mi primer Docker con HTML
</p>
Crear Imagen
docker buil -t <nombre>:<tag> .
Montar Contenedor
docker run -d --name <nombre contenedor> -p 8001:80 <nombre imagen>
Last updated
Was this helpful?