
The Dockerfile
Simply a file or manifest that has all the commands needed to be run to create an image when you run ‘docker build’. You can find more information here: Dockerfile docs
Simple Dockerfile
Just to keep it simple a Dockerfile can be as simple as installing packages after setting up a server and creating some directories. Here’s an example:
0 1 2 3 4 5 6 7 |
FROM alpine:latest RUN apk add --no-cache \ openrc && \ mkdir -p /opt/app && \ chmod -R 777 /opt/app |
Here is a Dockerfile I used for a virtual host apache image:
https://github.com/mfung/alpine_apache2_php7
Commands
Some commands when dealing with building an image:
0 1 2 3 4 5 6 7 |
# here is an example I used to build my alpine erlang elixir phoenix image docker build --no-cache --compress --squash -t mengfung/alpine-erlang-elixir-phoenix:latest -t mengfung/alpine-erlang-elixir-phoenix:v0.0.1 . # to push up my images to hub.docker.com docker push |