| 1 | <h2>Comments</h2> |
| 2 | <pre><code># These are the comments for a dockerfile. |
| 3 | # I want to make sure $(variables) don't break out, |
| 4 | # and we shouldn't see keywords like ADD or ENTRYPOINT |
| 5 | |
| 6 | # I also want to make sure that this "string" and this 'string' don't break out. |
| 7 | </code></pre> |
| 8 | |
| 9 | <h2>Full example</h2> |
| 10 | <pre><code># Nginx |
| 11 | # |
| 12 | # VERSION 0.0.1 |
| 13 | |
| 14 | FROM ubuntu |
| 15 | MAINTAINER Victor Vieux <[email protected]> |
| 16 | |
| 17 | LABEL Description="This image is used to start the foobar executable" Vendor="ACME Products" Version="1.0" |
| 18 | RUN apt-get update && apt-get install -y inotify-tools nginx apache2 openssh-server |
| 19 | |
| 20 | # Firefox over VNC |
| 21 | # |
| 22 | # VERSION 0.3 |
| 23 | |
| 24 | FROM ubuntu |
| 25 | |
| 26 | # Install vnc, xvfb in order to create a 'fake' display and firefox |
| 27 | RUN apt-get update && apt-get install -y x11vnc xvfb firefox |
| 28 | RUN mkdir ~/.vnc |
| 29 | # Setup a password |
| 30 | RUN x11vnc -storepasswd 1234 ~/.vnc/passwd |
| 31 | # Autostart firefox (might not be the best way, but it does the trick) |
| 32 | RUN bash -c 'echo "firefox" >> /.bashrc' |
| 33 | |
| 34 | EXPOSE 5900 |
| 35 | CMD ["x11vnc", "-forever", "-usepw", "-create"] |
| 36 | |
| 37 | # Multiple images example |
| 38 | # |
| 39 | # VERSION 0.1 |
| 40 | |
| 41 | FROM ubuntu |
| 42 | RUN echo foo > bar |
| 43 | # Will output something like ===> 907ad6c2736f |
| 44 | |
| 45 | FROM ubuntu |
| 46 | RUN echo moo > oink |
| 47 | # Will output something like ===> 695d7793cbe4 |
| 48 | |
| 49 | # You᾿ll now have two images, 907ad6c2736f with /bar, and 695d7793cbe4 with |
| 50 | # /oink. |
| 51 | </code></pre> |