How to Automatically Build and Configure Custom Docker Images with Docker file
Krishna's TechInfo
In this video I have expained about How to Automatically Build and Configure Custom Docker Images with Docker file. FROM ubuntu MAINTAINER your_name user@domain.tld RUN apt-get update RUN apt-get install tzdata -y RUN apt-get -y install apache2 RUN echo “Hello Apache server on Ubuntu Docker” /var/www/html/index.html EXPOSE 80 CMD /usr/sbin/apache2ctl -D FOREGROUND
docker build -t ubuntu-apache /var/docker/ubuntu/apache/
docker images
docker run --name my-www -d -p 81:80 ubuntu-apache
docker stats my-www
vi /etc/systemd/system/apache-docker.service
[Unit] Description=apache container Requires=docker.service After=docker.service
[Service] Restart=always ExecStart=/usr/bin/docker start -a my-www ExecStop=/usr/bin/docker stop -t 2 my-www
[Install] WantedBy=local.target
systemctl daemon-reload systemctl start apache-docker.service systemctl status apache-docker.service ... https://www.youtube.com/watch?v=xpgzI1y14gE
18452618 Bytes