Saturday, October 29, 2016

Dockerfile Commands

A list of commands are defined to build Docker image.

  • FROM

The first statement/command in the docker file which tells which image to download and start from.

  • MAINTAINER

Describes the author of the docker file.

MAINTAINER <First name> <Last name> <email address>

  • RUN

Run a command, wait for the result and then saves the result.

RUN echo hello docker

  • ADD

Adds local files, contents of a tar archives and works with urls.

  • ENV

Helps to set environment variables, both during the build and when running the result.

ENV artifactId=com.org.artifactId

  • ENTRYPOINT

Specifies the start of the command to run

  • CMD

Specifies the whole command to run

  • EXPOSE

Maps a port into the container

EXPOSE 8080

  • VOLUME

Defines shared or ephemeral volumes.

VOLUME [“/host/path/” “/container/path/”]

VOLUME [“/shared-data”]

  • WORKDIR

Sets the directory the container starts in. It is similar to use ‘cd’ after start.

WORKDIR /install/

  • USER

Sets which user the container will run as.

USER bimal

USER 1000

No comments:

Post a Comment