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

猜你喜欢

转载自blog.csdn.net/baidu_25845567/article/details/86082721