Example Dockerfile
Adam K Dean
Posted on June 10, 2014
Here is an example Dockerfile. It installs nginx and adds /src to the wwwroot. Make sure that the files are 755.
# DOCKER-VERSION 0.9.1
FROM ubuntu
MAINTAINER Adam K Dean
RUN apt-get update
RUN apt-get -y install nginx
RUN echo "daemon off;" >> /etc/nginx/nginx.conf
ADD default /etc/nginx/sites-available/default
ADD /src /var/www
EXPOSE 80
CMD ["nginx"]
FROM
defines the base image.
RUN
runs a command, use it to install software for example.
ADD
adds local files to the container.
EXPOSE
exposes a port so that the host can map a port to tunnel to it.
CMD
defines the command that will be run when the container starts. There can only be one command, if there are multiple, the last one will be used. You can pass parameters to it like so:
CMD ["service", "parameter"]
💖 💪 🙅 🚩
Adam K Dean
Posted on June 10, 2014
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
docker Docker Compose: Defining Nginx, PostgreSQL and Node.js Services for a Web Application
August 1, 2024