1. 程式人生 > >A simple example of Dockerfile

A simple example of Dockerfile

FROM ubuntu

MAINTAINER Tom

USER root

ENV BAQI=lijie

RUN apt-get update
RUN apt-get install -y nginx
ADD ["go1.11.linux-amd64.tar.gz","/usr/local/"]
COPY ["go1.10.linux-amd64.tar.gz","/Xuli/"]
ARG hair
WORKDIR /Xuli
RUN touch lijie
RUN echo $hair>lijie

ENTRYPOINT ["nginx"]
CMD ["-g","daemon off;"]

VOLUME ["/aiyolamemei"]

EXPOSE 80

Usage of ONBUILD

FROM ubuntu

MAINTAINER Tom

RUN apt-get update
RUN apt-get install -y nginx
ONBUILD ADD ["go1.11.linux-amd64.tar.gz","/usr/local/"]

EXPOSE 80
FROM ubuntu-nginx:v0.2

MAINTAINER Tom

RUN apt-get update
RUN apt-get install -y nginx
WORKDIR /usr/local

EXPOSE 80

Build golang environment

FROM ubuntu

MAINTAINER Tom

RUN apt-get update
RUN apt-get install -y nginx
ADD ["go1.11.linux-amd64.tar.gz","/usr/local/"]
COPY ["main.go","/root/go/src/"]

ENV GOROOT=/usr/local/go
ENV GOPATH=/root/go
ENV PATH=$GOROOT/bin:$GOPATH/bin:$PATH

EXPOSE 80