0% found this document useful (0 votes)
42 views2 pages

Class 17 Notes

Uploaded by

kamal soni
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
42 views2 pages

Class 17 Notes

Uploaded by

kamal soni
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

$ docker images

Dockerfile
==========
INSTRUCTIONS OS_CMD/OPTIONS
------------ --------------
FROM <BaseImageName>
RUN <OS-CMD/SCRIPT>
CMD <OS-CMD/SCRIPT> # This will get executed in the begining during
runtime
["executable","arg1","arg2"]
ENTRYPOINT ["executable","arg1","arg2"]
ENV <EnvVariable> <Value>
USER <userId>
WORKDIR <dir>
COPY <Host-Src> <Image-Dest>
ADD <Host-Src> <Image-Dest>
EXPOSE <Port>

Example:
FROM centos
RUN yum -y update
RUN yum install -y vim
RUN touch /tmp/DUMMY
CMD ["/bin/bash"]
ENV JAVA_HOME /opt/jdk1.8
ENV MYNAME ADAM
USER adam
WORKDIR /tmp
COPY startup.sh /tmp/startup.sh
ADD test.tar /tmp
EXPOSE 8080

ENTRYPOINT ["/bin/sh","startup.sh"]
/bin/sh startup.sh -xarg2

$ docker build -t <ImageName> -f <Dockerfile> .


$ docker build -t myimg0 .

$ docker run -it --name myimg1 -xmx4gb

/bin/sh -c "while true; do echo hello-students; sleep 8; done

#!/bin/sh
while true
do
echo hello-students
sleep 8
done

$ docker run -d -p 8080:8080 jenkins


==========
FROM ubuntu:12.04
RUN apt-get update && apt-get install -y apache2 && apt-get clean && rm -rf
/var/lib/apt/lists/*
ENV APACHE_RUN_USER www-data
ENV APACHE_RUN_GROUP www-data
ENV APACHE_LOG_DIR /var/log/apache2
EXPOSE 80
CMD ["/usr/sbin/apache2", "-D", "FOREGROUND"]
======

$ docker run -d -p 80:8080 myapache


Thanks & Regards,

*Ajitha Gomathi*
*WEZVA Coordinator* | Mob : +91-9739110917

You might also like