Dockerfile

Aus robopagex.com
Zur Navigation springen Zur Suche springen

Dockerfile

Best practices for writing Dockerfiles
Dockerfile reference

Erstellen eines Docker Image

Dockerfile >> *Build* >> Docker Image >> *Run* >>> Docker Container

BUILD BASIC IMAGE

Select Base-Image
FROM alpine:latest 
Text Information, Description, etc..
LABEL name="Basic Image" 
LABEL version="1.0" 
LABEL description="A new basic image" 
LABEL maintainer="robopagex.com" 
LABEL contact="mymail@robopagex.com" 
ADD & COPY
ADD URL
ADD FOLDER
ADD TAR
COPY FILE
FOR BOTH: --chown=user:group

RUN execute on build, multiple run possible

  RUN echo "HELLO" 
  RUN apt-get update && \ 
      apt-get upgrade -y 

Only one at the end

  CMD ["/bin/bash"] 
  CMD ["echo","Hello"] 
  CMD ["com","arg","arg"] 

Overwrite CMD IP with robopagex.com

  ENTRYPOINT ["/bin/ping"]
  CMD ["127.0.0.1"] 
  docker run -it myalpine robopagex.com
  CMD ["/bin/ping","127.0.0.1"] 
  docker run -it myalpine robopagex.com
  CMD ["/bin/ping","127.0.0.1"] 
  docker run -it myalpine bash


  FROM alpine:latest 
  RUN mkdir -p /app 
  COPY . /app 

JUMP INTO WORKDIR

  WORKDIR /app 
  docker run -it myalpine
  FROM alpine:latest 
  ENV name TEST 
  RUN echo "Hello, $name" 
  ENV nginx_conf /app/myconf.conf