4

Unable to start container with docker-compose up

Docker version 1.9.1, build a34a1d5

Dockerfile

FROM ubuntu

# File Author / Maintainer
MAINTAINER Parzee info@parzee.com

# Install Components.

# Update the repository
ENV LANG en_US.UTF-8
ENV DEBIAN_FRONTEND noninteractive

RUN apt-get update
RUN locale-gen en_US en_US.UTF-8
# Install necessary tools
RUN apt-get install -y nano vim wget dialog net-tools
RUN apt-get install lighttpd -y
RUN apt-get install php5-common php5-cgi php5 -y
RUN lighty-enable-mod fastcgi-php
RUN update-rc.d -f lighttpd disable
RUN mkdir -p /usr/local/src/imbue/application/imbue/utils/security/des

ADD lighttpd.conf /etc/lighttpd/

VOLUME ["/var/log/lighttpd"]

RUN ls -al /etc/lighttpd/lighttpd.conf

RUN /usr/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf

EXPOSE 8083

docker-compose.yml

lighttpd:
  image: parzee/lighttpd
  ports: 
    - "8083:8083"
  volumes:
    - volumes/log:/var/log/lighttpd 

When I run:

docker run -h lighttpd -p 8083:8083 -d -v `pwd`/volumes/log:/var/log/lighttpd -t parzee/lighttpd

my container starts fine, but with docker-compose up I get the following error:

Creating lighttpd_lighttpd_1
ERROR: volumes/log includes invalid characters for a local volume name, only [a-zA-Z0-9][a-zA-Z0-9_.-] are allowed

This is the file structure:

.
├── docker-compose.yml
├── Dockerfile
├── lighttpd.conf
└── volumes
    ├── etc
    │   └── lighttpd
    │       └── lighttpd.conf
    └── log

4 directories, 4 files
gogasca
  • 343
  • 2
  • 15

2 Answers2

4

The yaml is quite picky on docker compose. Make sure the path is absolute (for the host side) and contains no trailing spaces.

"- volumes/log:/var/log/lighttpd "

Should be

"- /host/path/volumes/log:/var/log/lighttpd"

Without the quotes! I put those in to highlight the problem.

If you really need relative paths consider using crane instead of docker-compose.

hookenz
  • 14,472
  • 23
  • 88
  • 143
1

To use relative paths in volumes section, you've to add ./, e.g.

  volumes:
    - ./volumes/log:/var/log/lighttpd

Or from the command-line, like:

docker run -v $PWD/volumes/log:/var/log/lighttpd ...
kenorb
  • 6,499
  • 2
  • 46
  • 54