- Create your Docker File
- Create your Fig file
- Fig up
FROM ubuntu:12.04 MAINTAINER Nick Lang "email@example.com" RUN apt-get update RUN apt-get install -y python-dev python-setuptools supervisor git-core libpq-dev RUN easy_install pip RUN pip install virtualenv RUN virtualenv --no-site-packages /venvs/docker_madness ADD . /docker_madness ADD .docker/supervisor.conf /etc/supervisor/supervisor.conf ADD .docker/run.sh /run.sh RUN /venvs/docker_madness/bin/pip install -r /docker_madness/requirements.txt RUN (cd /docker_madness && /venvs/docker_madness/bin/python manage.py collectstatic --noinput) EXPOSE 8000 CMD ["/bin/sh", "-e", "/run.sh"]
What's going on in the Dockerfile
The Dockerfile is just a list of instruction that docker uses to construct the image.
There are more commands but this is a very simple list to get us started
FROM - is the image that our image will be based off of
MAINTAINER - the creator/maintainer of the image
RUN - command to be run and "recorded"
ADD - Add files from the "host" machine to the image
EXPOSE - Ports to expose when the container is running
CMD - command to be run when the container is run
What's the difference between an image and a container?
An image is what is created on `docker build`. It's a series of layers to be transfered around.
A container is what is actually running.
db: image: postgres web: build: . command: sh /run.sh volumes: - .:/docker_madness ports: - "8000:8000" links: - db
What's happening in the fig.yml?
We list out our container names on the first level.
The subsequent levels have information pertaining to each container to be run.
Lets run it?
demo gods be nice
Docker Development with Fig
By Nick Lang