When I started playing with Docker I was running a lot of commands to build image, delete containers running on old image, run containers based on new image, etc… A lot of log commands with links, volumes, etc…
Then I started searching for something to automate this task and here I get to docker-compse command, this is how you may install it:

pip install docker-compose

And install additional bash completions (run as root):

curl -L https://raw.githubusercontent.com/docker/compose/$(docker-compose version --short)/contrib/completion/bash/docker-compose > /etc/bash_completion.d/docker-compose

Then you may prepare docker-compose.yml file like:

web:
  build: .
  command: php -S 0.0.0.0:8000 -t /code
  ports:
    - "8000:8000"
  links:
    - db
  volumes:
    - .:/code
db:
  image: orchardup/mysql
  environment:
    MYSQL_DATABASE: wordpress

More informations about syntax may be found here: https://docs.docker.com/compose/compose-file/external link

And run such environment with:

docker-compose up

Or to run this in background:

docker-compose up -d

To stop and cleanup it use:

docker-compose stop && docker-compose rm -f -v

Other usable commands are:

docker-compose build --force-rm # to rebuild images and clean after
docker-compose ps               # to list containers

I’m still playing with volumes in this but don’t have anything interesting enough to paste here - maybe later.

Sources

https://docs.docker.com/compose/install/external link
https://docs.docker.com/compose/completion/external link