create a dockerfile code example

Example 1: docker build

docker build -t [tag] .

Example 2: docker create

docker create [options] IMAGE
  -a, --attach               # attach stdout/err
  -i, --interactive          # attach stdin (interactive)
  -t, --tty                  # pseudo-tty
      --name NAME            # name your image
  -p, --publish 5000:5000    # port map
      --expose 5432          # expose a port to linked containers
  -P, --publish-all          # publish all ports
      --link container:alias # linking
  -v, --volume `pwd`:/app    # mount (absolute paths needed)
  -e, --env NAME=hello       # env vars

Example 3: how to create docker image from custom filename

cat DockerFile.debian.foo | docker build -t debian.foo -

Example 4: create dockerfile

FROM ubuntu:18.04
COPY . /app
RUN make /app
CMD python /app/app.py

Tags:

Go Example