Dockerfile
Check out https://hub.docker.com/search/?type=image for bases
Dockerfile
A Docker image consists of read-only layers each of which represents a Dockerfile instruction
Commands
Use env variables you declare with env like $foo
RUn
RUN has 2 forms:
RUN <command>
(shell form, the command is run in a shell, which by default is/bin/sh -c
on Linux orcmd /S /C
on Windows)RUN ["executable", "param1", "param2"]
(exec form)
CMD
The CMD
instruction has three forms:
CMD ["executable","param1","param2"]
(exec form, this is the preferred form)CMD ["param1","param2"]
(as default parameters to ENTRYPOINT)CMD command param1 param2
(shell form)
There can only be one CMD
instruction in a Dockerfile
. If you list more than one CMD
then only the last CMD
will take effec
ENV
ADD
COPY
Like ADD, but without urls and tar handling, should be used when you dont need ADD
Dockerignore
Add things to .dockerignore
file to prevent copying
Last updated