-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
82 lines (66 loc) · 1.77 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
Set the base image to Ubuntu *must be first instruction* - use docker search to find images
```dockerfile
FROM ubuntu # <image>
FROM ubuntu:latest # - <image>:<tag>
FROM ubuntu:precise (LTS)
```
Set the maintainer info
```dockerfile
MAINTAINER Adam Veldhousen, [email protected] # <name>
```
Copy a local/remote file into the container
Also supports auto extracting of .tar.gz into destination and can copy from remote locations (ie raw.github)
```dockerfile
ADD ./index.html /var/www/index.html # <src> <dest>
```
Prefer copy over add: http://docs.docker.com/articles/dockerfile_best-practices/#add-or-copy
Copy only supports copying local files
```dockerfile
COPY ./index.html /var/www/index.html
```
Sets the user name to use
```dockerfile
USER username
```
ENV set env vars
```dockerfile
ENV KEY 1234 # <key> <value>
```
Runs a command on the image and commits the result
```dockerfile
RUN apt-get install vim # <command> - equivalent to docker run ubuntu apt-get install vim && docker commit XXXX
```
The WORKDIR directive is used to set where the command defined with CMD is to be executed.
```
WORKDIR /home/dev
```
Like an exec, preferred (A minimal $PATH only)
```dockerfile
ENTRYPOINT ["executable", "param1", "param2"]
```
Execute as a shell (Your $PATH is setup this way)
```dockerfile
ENTRYPOINT command param1 param2
```
this:
```dockerfile
CMD ["-l","-"]
ENTRYPOINT ["/usr/bin/wc"]
```
and this:
```dockerfile
ENTRYPOINT wc -l -
```
and this:
```dockerfile
ENTRYPOINT ["wc", "-l", "-"]
```
are all equivalent
Exposes this port on the container to the outside world
```dockerfile
EXPOSE 80 # <port> [<port>...]
```
Adds one or more new volumes to any container created from the image
```dockerfile
VOLUME ["/data"] # [<volumes>...], puts /data -> /var/lib/docker/volumes/
```