title | description | created | updated |
---|---|---|---|
Dockerfile Syntax |
Dockerfile Syntax |
2019-09-15 |
2019-09-15 |
Syntax
FROM <image>:<tag>
Example
FROM ubuntu:16.04
Syntax
ENV <key> <value>
Example
ENV JAVA_HOME /usr/lib/jvm/java-8-oracle
Syntax
RUN <command>
Example
RUN apt-get update
Syntax
EXPOSE <port> [<port> ...]
Example
EXPOSE 8080 9200
Syntax
COPY <src> [<src> ...] <dest>
Example
COPY file1.txt /opt/app/file1.txt
Syntax
ADD <src> [<src> ...] <dest>
Example
ADD file1.txt /opt/app/file1.txt
ADD jdk-8u120-linux-x64.tar.gz /usr/local/ # ADD unzips for you
ADD http://example.com/app.tar.xz /opt/app/ # ADD also support urls
Syntax
VOLUME </path/from/host> </path/from/docker-container>
Example
VOLUME /data /mongodb/db/data
Sets working directory where other commands run Syntax
WORKDIR <path>
Example
WORKDIR /opt/app
Syntax
CMD <command> [<command> ...]
Example
CMD ['node' 'index.js']